Skip to main content
Glama

telegraph_create_from_template

Create Telegraph pages using predefined templates for blog posts, documentation, articles, changelogs, or tutorials with structured data input.

Instructions

Create a new Telegraph page using a template

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
access_tokenYesAccess token of the Telegraph account
templateYesTemplate to use
titleYesPage title
dataYesTemplate data (fields depend on template type)
author_nameNoAuthor name
author_urlNoAuthor URL
return_contentNo

Implementation Reference

  • Handler logic for 'telegraph_create_from_template': validates input with schema, retrieves and generates template content, creates Telegraph page using telegraph.createPage, and returns the result as JSON.
    if (name === 'telegraph_create_from_template') {
      const input = CreateFromTemplateSchema.parse(args);
      const template = getTemplate(input.template);
    
      if (!template) {
        throw new Error(`Unknown template: ${input.template}`);
      }
    
      const htmlContent = template.generate(input.data);
      const content = telegraph.parseContent(htmlContent);
    
      const result = await telegraph.createPage(
        input.access_token,
        input.title,
        content,
        input.author_name,
        input.author_url,
        input.return_content
      );
    
      return {
        content: [{
          type: 'text' as const,
          text: JSON.stringify(result, null, 2),
        }],
      };
    }
  • Zod schema defining the input parameters for the telegraph_create_from_template tool, used for validation in the handler.
    export const CreateFromTemplateSchema = z.object({
      access_token: z.string().describe('Access token of the Telegraph account'),
      template: z.enum(['blog_post', 'documentation', 'article', 'changelog', 'tutorial'])
        .describe('Template to use'),
      title: z.string().min(1).max(256).describe('Page title'),
      data: z.record(z.unknown()).describe('Template data fields'),
      author_name: z.string().max(128).optional(),
      author_url: z.string().max(512).optional(),
      return_content: z.boolean().optional(),
    });
  • Tool registration object defining name, description, and inputSchema for 'telegraph_create_from_template', included in templateTools array exported and combined into allTools.
    {
      name: 'telegraph_create_from_template',
      description: 'Create a new Telegraph page using a template',
      inputSchema: {
        type: 'object' as const,
        properties: {
          access_token: {
            type: 'string',
            description: 'Access token of the Telegraph account',
          },
          template: {
            type: 'string',
            enum: ['blog_post', 'documentation', 'article', 'changelog', 'tutorial'],
            description: 'Template to use',
          },
          title: {
            type: 'string',
            description: 'Page title',
          },
          data: {
            type: 'object',
            description: 'Template data (fields depend on template type)',
          },
          author_name: {
            type: 'string',
            description: 'Author name',
          },
          author_url: {
            type: 'string',
            description: 'Author URL',
          },
          return_content: {
            type: 'boolean',
            default: false,
          },
        },
        required: ['access_token', 'template', 'title', 'data'],
      },
    },
  • Combines templateTools (including telegraph_create_from_template) into allTools, which is used by the MCP server for tool listing.
    export const allTools = [...accountTools, ...pageTools, ...templateTools, ...exportTools];
  • src/index.ts:137-141 (registration)
    MCP server handler for listing tools, returns allTools including the telegraph_create_from_template tool.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: allTools,
      };
    });
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool creates a page, implying a write operation, but doesn't mention permissions needed (e.g., access token validity), side effects (e.g., page visibility), rate limits, or what happens on failure. This leaves significant gaps for a mutation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose ('Create a new Telegraph page using a template') with zero wasted words. It is appropriately sized for the tool's complexity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (7 parameters, mutation operation, no output schema, and no annotations), the description is inadequate. It doesn't explain the return value, error handling, or behavioral nuances like the 'return_content' parameter's effect, leaving the agent with insufficient context for reliable use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is high at 86%, with detailed parameter descriptions in the schema itself. The description adds no additional meaning beyond implying template usage, which is already covered by the 'template' parameter's enum. Thus, it meets the baseline for high schema coverage without compensating for gaps.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Create a new Telegraph page') and the method ('using a template'), which is specific and distinguishes it from the sibling 'telegraph_create_page' that presumably creates pages without templates. However, it doesn't explicitly contrast with that sibling, keeping it from a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'telegraph_create_page' or 'telegraph_list_templates'. It lacks context about prerequisites (e.g., needing an account or template availability) or exclusions, offering minimal usage direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/NehoraiHadad/telegraph-mcp'

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