Skip to main content
Glama

delete_doc

Remove a specified document from the Yuque knowledge base using namespace and document ID. Ensure proper authorization with an access token. Note: This action is irreversible.

Instructions

从语雀知识库中删除指定文档,此操作不可撤销

Input Schema

NameRequiredDescriptionDefault
accessTokenNo用于认证 API 请求的令牌
idYes要删除的文档ID
namespaceYes知识库的命名空间,格式为 user/repo

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "accessToken": { "description": "用于认证 API 请求的令牌", "type": "string" }, "id": { "description": "要删除的文档ID", "type": "number" }, "namespace": { "description": "知识库的命名空间,格式为 user/repo", "type": "string" } }, "required": [ "namespace", "id" ], "type": "object" }

Implementation Reference

  • The main handler function for the 'delete_doc' tool, which creates YuqueService, calls deleteDoc, and returns formatted response.
    async ({ namespace, id, accessToken }) => { try { Logger.log(`Deleting document ${id} from repository: ${namespace}`); const yuqueService = this.createYuqueService(accessToken); await yuqueService.deleteDoc(namespace, id); Logger.log(`Successfully deleted document ${id}`); return { content: [ { type: "text", text: `Document ${id} has been successfully deleted`, }, ], }; } catch (error) { Logger.error( `Error deleting doc ${id} from repo ${namespace}:`, error ); return { content: [{ type: "text", text: `Error deleting doc: ${error}` }], }; } }
  • Zod input schema for 'delete_doc' tool parameters: namespace, id, optional accessToken.
    { namespace: z.string().describe("知识库的命名空间,格式为 user/repo"), id: z.number().describe("要删除的文档ID"), accessToken: z.string().optional().describe("用于认证 API 请求的令牌"), },
  • src/server.ts:456-489 (registration)
    MCP server tool registration for 'delete_doc' with description, schema, and handler.
    this.server.tool( "delete_doc", "从语雀知识库中删除指定文档,此操作不可撤销", { namespace: z.string().describe("知识库的命名空间,格式为 user/repo"), id: z.number().describe("要删除的文档ID"), accessToken: z.string().optional().describe("用于认证 API 请求的令牌"), }, async ({ namespace, id, accessToken }) => { try { Logger.log(`Deleting document ${id} from repository: ${namespace}`); const yuqueService = this.createYuqueService(accessToken); await yuqueService.deleteDoc(namespace, id); Logger.log(`Successfully deleted document ${id}`); return { content: [ { type: "text", text: `Document ${id} has been successfully deleted`, }, ], }; } catch (error) { Logger.error( `Error deleting doc ${id} from repo ${namespace}:`, error ); return { content: [{ type: "text", text: `Error deleting doc: ${error}` }], }; } } );
  • YuqueService helper method implementing the DELETE API call to delete the document.
    async deleteDoc(namespace: string, id: number): Promise<YuqueDoc> { const response = await this.client.delete(`/repos/${namespace}/docs/${id}`); 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/HenryHaoson/Yuque-MCP-Server'

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