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