Skip to main content
Glama

yuque_update_doc

Update existing documents in Yuque knowledge bases by modifying titles, content, and formats using document and repository IDs.

Instructions

更新文档 (Update existing document)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
docIdYes文档ID (Document ID)
repoIdYes知识库ID (Repository ID)
titleNo文档标题 (Document title)
contentNo文档内容 (Document content)
formatNo文档格式 (Document format)

Implementation Reference

  • Tool schema definition for 'yuque_update_doc', including input validation schema.
    { name: 'yuque_update_doc', description: '更新文档 (Update existing document)', inputSchema: { type: 'object', properties: { docId: { type: 'number', description: '文档ID (Document ID)', }, repoId: { type: 'number', description: '知识库ID (Repository ID)', }, title: { type: 'string', description: '文档标题 (Document title)', minLength: 1, maxLength: 200, }, content: { type: 'string', description: '文档内容 (Document content)', }, format: { type: 'string', enum: ['markdown', 'lake', 'html'], description: '文档格式 (Document format)', }, }, required: ['docId', 'repoId'], }, },
  • The primary handler function that executes the yuque_update_doc tool logic by invoking the Yuque client and formatting the response.
    async function handleUpdateDoc( client: YuqueClient, args: { docId: number; repoId: number; title?: string; content?: string; format?: 'markdown' | 'lake' | 'html'; } ) { const doc = await client.updateDoc( args.docId, args.repoId, args.title, args.content, args.format ); return { content: [ { type: 'text', text: JSON.stringify(doc, null, 2), }, ], }; }
  • src/server.ts:46-50 (registration)
    Registers the listTools endpoint which provides the schema for yuque_update_doc via YUQUE_TOOLS.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: YUQUE_TOOLS, }; });
  • src/server.ts:53-56 (registration)
    Registers the callTool endpoint which dispatches to handleTool, eventually executing yuque_update_doc handler.
    server.setRequestHandler(CallToolRequestSchema, async (request) => { try { return await handleTool(request, { client: yuqueClient }); } catch (error) {
  • Helper method in YuqueClient that performs the actual API PUT request to update the document.
    async updateDoc( docId: number, repoId: number, title?: string, content?: string, format?: 'markdown' | 'lake' | 'html' ): Promise<YuqueDoc> { const data: any = {}; if (title) data.title = title; if (content) data.body = content; if (format) data.format = format; return this.request<YuqueDoc>(`/repos/${repoId}/docs/${docId}`, { method: 'PUT', data, }); }

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/tanis2010/yuque-mcp-server'

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