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

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