get_entry_by_slug
Retrieve a blog entry by its URL slug to access its content and metadata.
Instructions
[read] Fetch a single entry by its URL slug (matches /post/ on the site).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| slug | Yes |
Implementation Reference
- src/tools.ts:210-211 (handler)The handler function for get_entry_by_slug that makes a GET request to /api/v1/entry/slug/{slug} using the FeedbagelClient.
handler: ({ slug }: any, c) => c.request("GET", `/api/v1/entry/slug/${encodeURIComponent(slug)}`), - src/tools.ts:207-209 (schema)Input schema for get_entry_by_slug validating the 'slug' field as a string of 1-300 characters.
inputSchema: z.object({ slug: z.string().min(1).max(300), }), - src/tools.ts:203-212 (registration)Tool registration entry in the TOOLS array, defining name, description, scope, inputSchema, and handler for get_entry_by_slug.
name: "get_entry_by_slug", description: "Fetch a single entry by its URL slug (matches /post/<slug> on the site).", scope: "read", inputSchema: z.object({ slug: z.string().min(1).max(300), }), handler: ({ slug }: any, c) => c.request("GET", `/api/v1/entry/slug/${encodeURIComponent(slug)}`), }, - src/index.ts:37-43 (registration)MCP server registration: ListToolsRequestSchema handler that exposes tool definitions (including get_entry_by_slug) to the client.
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS.map((t) => ({ name: t.name, description: `[${t.scope}] ${t.description}`, inputSchema: zodToJsonSchema(t.inputSchema, { target: "openApi3" }), })), })); - src/index.ts:45-86 (registration)MCP server registration: CallToolRequestSchema handler that dispatches incoming tool calls (including get_entry_by_slug) to the matching handler.
server.setRequestHandler(CallToolRequestSchema, async (req) => { const tool = TOOLS.find((t) => t.name === req.params.name); if (!tool) { return { isError: true, content: [{ type: "text", text: `Unknown tool: ${req.params.name}` }], }; } const parsed = tool.inputSchema.safeParse(req.params.arguments ?? {}); if (!parsed.success) { return { isError: true, content: [ { type: "text", text: `Invalid arguments: ${parsed.error.message}`, }, ], }; } try { const result = await tool.handler(parsed.data, client); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; } catch (err) { const e = err as Error & { status?: number; body?: unknown }; return { isError: true, content: [ { type: "text", text: JSON.stringify( { error: e.message, status: e.status, body: e.body }, null, 2, ), }, ], }; } });