Skip to main content
Glama

get_draft_detail

Retrieve detailed information about a specific draft by providing its ID. This tool is used for accessing and managing draft content in the Emlog blog system via the MCP server.

Instructions

Get details of a specific draft

Input Schema

NameRequiredDescriptionDefault
idYesThe ID of the draft to retrieve

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "id": { "description": "The ID of the draft to retrieve", "type": "number" } }, "required": [ "id" ], "type": "object" }

Implementation Reference

  • The MCP tool handler function for 'get_draft_detail' that fetches the draft using emlogClient.getDraftDetail and returns formatted text output.
    async ({ id }) => { try { const result = await emlogClient.getDraftDetail(id); const draft = result.draft; return { content: [{ type: "text", text: `Draft Details:\n\nTitle: ${draft.title}\nID: ${draft.id}\nDate: ${draft.date}\nAuthor: ${draft.author_name}\nCategory: ${draft.sort_name || 'Uncategorized'}\nExcerpt: ${draft.excerpt || 'No excerpt'}\n\n--- Content ---\n${draft.content}` }] }; } catch (error) { return { content: [{ type: "text", text: `Error: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } }
  • Input schema definition for the 'get_draft_detail' tool, specifying the required 'id' parameter.
    { title: "Get Draft Detail", description: "Get details of a specific draft", inputSchema: { id: z.number().describe("The ID of the draft to retrieve") } },
  • src/index.ts:607-636 (registration)
    Registration of the 'get_draft_detail' tool on the MCP server using server.registerTool.
    server.registerTool( "get_draft_detail", { title: "Get Draft Detail", description: "Get details of a specific draft", inputSchema: { id: z.number().describe("The ID of the draft to retrieve") } }, async ({ id }) => { try { const result = await emlogClient.getDraftDetail(id); const draft = result.draft; return { content: [{ type: "text", text: `Draft Details:\n\nTitle: ${draft.title}\nID: ${draft.id}\nDate: ${draft.date}\nAuthor: ${draft.author_name}\nCategory: ${draft.sort_name || 'Uncategorized'}\nExcerpt: ${draft.excerpt || 'No excerpt'}\n\n--- Content ---\n${draft.content}` }] }; } catch (error) { return { content: [{ type: "text", text: `Error: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } } );
  • Core helper method in EmlogClient that makes the REST API call to retrieve draft details by ID.
    async getDraftDetail(id: number): Promise<{ draft: EmlogPost }> { const queryParams = this.buildParams({ id }); const response = await this.api.get(`/?rest-api=draft_detail&${queryParams.toString()}`); return response.data.data; }

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/eraincc/emlog-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server