Skip to main content
Glama

Get Draft Detail

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

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe ID of the draft to retrieve

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;
    }

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

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