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;
    }
Behavior4/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 clearly states the tool performs a deletion and that it's irreversible ('此操作不可撤销'), which is critical behavioral information. However, it does not mention authentication requirements, rate limits, or error handling, leaving some gaps.

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 key information: the action, resource, and critical warning about irreversibility. Every word earns its place with no redundancy or unnecessary details.

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

Completeness3/5

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

For a destructive tool with no annotations and no output schema, the description is moderately complete. It covers the core purpose and irreversible nature but lacks details on authentication (implied by 'accessToken' in schema), response format, or error scenarios. Given the complexity, it should provide more behavioral context to be fully adequate.

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?

Schema description coverage is 100%, so the schema already documents all three parameters ('namespace', 'id', 'accessToken') with descriptions. The description does not add any additional meaning or context beyond what the schema provides, such as format examples or usage tips, meeting the baseline for high coverage.

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

Purpose5/5

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

The description clearly states the action ('删除' meaning 'delete'), the resource ('文档' meaning 'document'), and the system context ('从语雀知识库中' meaning 'from Yuque knowledge base'). It distinguishes from siblings like 'create_doc', 'update_doc', and 'get_doc' by specifying the destructive delete operation.

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

Usage Guidelines3/5

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

The description implies usage for deleting documents in Yuque, but does not explicitly state when to use this tool versus alternatives (e.g., 'update_doc' for modifications or 'get_doc' for retrieval). It mentions the operation is irreversible, which provides some contextual guidance but lacks explicit comparisons or prerequisites.

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/HenryHaoson/Yuque-MCP-Server'

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