@crazyrabbitltc/railway-mcp
Version:
Railway MCP Server - 146+ tools with 100% Railway API coverage, comprehensive MCP testing framework, and real infrastructure management through AI assistants. Enhanced version with enterprise features, based on original work by Jason Tan.
38 lines (37 loc) • 1.36 kB
JavaScript
export function createTool(name, description, schema, handler) {
return [
name,
description,
schema,
handler
];
}
export const formatToolDescription = ({ type, description, bestFor = [], notFor = [], relations = {}, }) => {
const sections = [
`[${type}] ${description}`,
// Best For section
bestFor.length > 0 && [
'⚡️ Best for:',
...bestFor.map(b => ` ✓ ${b}`)
].join('\n'),
// Not For section
notFor.length > 0 && [
'⚠️ Not for:',
...notFor.map(n => ` × ${n}`)
].join('\n'),
// Prerequisites section
(relations?.prerequisites?.length ?? 0) > 0 &&
`→ Prerequisites: ${relations?.prerequisites?.join(', ')}`,
// Alternatives section
(relations?.alternatives?.length ?? 0) > 0 &&
`→ Alternatives: ${relations?.alternatives?.join(', ')}`,
// Next Steps section
(relations?.nextSteps?.length ?? 0) > 0 &&
`→ Next steps: ${relations?.nextSteps?.join(', ')}`,
// Related section
(relations?.related?.length ?? 0) > 0 &&
`→ Related: ${relations?.related?.join(', ')}`
];
// Filter out falsy values and join with newlines
return sections.filter(Boolean).join('\n\n');
};