UNPKG

@mseep/railway-mcp

Version:

Model Context Protocol server for Railway.app - Enables AI agents to manage Railway infrastructure through natural language

38 lines (37 loc) 1.33 kB
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 && `→ Prerequisites: ${relations?.prerequisites?.join(', ')}`, // Alternatives section relations?.alternatives?.length > 0 && `→ Alternatives: ${relations?.alternatives?.join(', ')}`, // Next Steps section relations?.nextSteps?.length > 0 && `→ Next steps: ${relations?.nextSteps?.join(', ')}`, // Related section relations?.related?.length > 0 && `→ Related: ${relations?.related?.join(', ')}` ]; // Filter out falsy values and join with newlines return sections.filter(Boolean).join('\n\n'); };