(request: Request)
| 73 | |
| 74 | /** The toolkit slug selected by `/mcp/toolkits/:slug` or its metadata doc. */ |
| 75 | export const toolkitSlugFromRequest = (request: Request): string | null => { |
| 76 | const pathname = new URL(request.url).pathname; |
| 77 | const index = pathname.indexOf(TOOLKIT_SEGMENT); |
| 78 | if (index < 0) return null; |
| 79 | const slug = pathname.slice(index + TOOLKIT_SEGMENT.length).split("/", 1)[0]; |
| 80 | return slug && slug.length > 0 ? slug : null; |
| 81 | }; |
| 82 | |
| 83 | const toolkitMcpPath = (toolkitSlug: string | null): string => |
| 84 | toolkitSlug ? `${MCP_PATH}/toolkits/${toolkitSlug}` : MCP_PATH; |
no outgoing calls
no test coverage detected