@grebyn/toolflow-mcp-server
Version:
MCP server for managing other MCP servers - discover, install, organize into bundles, and automate with workflows. Uses StreamableHTTP transport with dual OAuth/API key authentication.
75 lines (72 loc) • 2.28 kB
JavaScript
/**
* Shared formatting functions for consistent responses across tools
*/
/**
* Format empty results message with consistent tips
*/
export function formatEmptyResults(searchInfo, itemType) {
const { query } = searchInfo;
const searchText = query ? ` matching "${query}"` : '';
const tipsByItemType = {
bundles: [
'- Try broader search terms like "web", "data", or "development"',
'- Create your own bundle with `create_bundle` if none exist for your needs'
],
workflows: [
'- Try broader search terms like "deployment", "testing", or "development"',
'- Create new workflows after completing multi-step tasks using `create_workflow`'
]
};
const tips = tipsByItemType[itemType].join('\n');
return {
content: [
{
type: 'text',
text: `📭 No organization ${itemType} found${searchText}.
**Tips for finding ${itemType}:**
${tips}`
}
]
};
}
/**
* Format pagination information
*/
export function formatPaginationInfo(pagination) {
const { limit, offset, totalResults } = pagination;
if (offset > 0 || totalResults === limit) {
const start = offset + 1;
const end = offset + totalResults;
return `\n\n**Pagination**: Showing ${start}-${end}. Use offset=${offset + limit} to see more results.`;
}
return '';
}
/**
* Format next steps section
*/
export function formatNextSteps(itemType) {
if (itemType === 'bundles') {
return `
**Next Steps:**
- Use \`get_bundle_config\` with a Bundle ID to see installation details
- Use \`write_client_config\` after getting bundle config to install all servers
- Create your own bundle with \`create_bundle\` to save your favorite server collections`;
}
else {
return `
Use perform_workflow with a workflow ID to check requirements and get instructions.`;
}
}
/**
* Common date formatter
*/
export function formatDate(dateString) {
return new Date(dateString).toLocaleDateString();
}
/**
* Format tags for display
*/
export function formatTags(tags) {
return tags && tags.length > 0 ? ` | Tags: ${tags.join(', ')}` : '';
}
//# sourceMappingURL=formatters.js.map