Skip to main content
Glama

delete_doc

Remove a document from a Yuque knowledge base by specifying its namespace and ID. This action is permanent and cannot be undone.

Instructions

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

Input Schema

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

Implementation Reference

  • Full tool registration block for 'delete_doc' including inline handler function that performs the deletion logic by calling yuqueService.deleteDoc()
    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}` }],
          };
        }
      }
    );
  • Zod input schema definition for the delete_doc tool parameters
    {
      namespace: z.string().describe("知识库的命名空间,格式为 user/repo"),
      id: z.number().describe("要删除的文档ID"),
      accessToken: z.string().optional().describe("用于认证 API 请求的令牌"),
    },
  • YuqueService helper method that executes the actual Yuque API DELETE request to remove the document.
    async deleteDoc(namespace: string, id: number): Promise<YuqueDoc> {
      const response = await this.client.delete(`/repos/${namespace}/docs/${id}`);
      return response.data.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/HenryHaoson/Yuque-MCP-Server'

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