Skip to main content
Glama

update_metadata

Modify metadata for documentation files in a project, including title, category, and tags, to enhance organization and searchability within the mcp-rtfm knowledge base.

Instructions

Update metadata for a documentation file

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
docFileYesName of the documentation file
metadataYesMetadata to update
projectPathYesPath to the project root directory

Implementation Reference

  • MCP CallTool handler for 'update_metadata': extracts parameters, verifies file existence, calls updateMetadata helper, and returns JSON response with updated metadata.
    case "update_metadata": {
      const { projectPath, docFile, metadata } = request.params.arguments as {
        projectPath: string;
        docFile: string;
        metadata: Partial<DocMetadata>;
      };
    
      try {
        const filePath = `${projectPath}/.handoff_docs/${docFile}`;
        await fs.access(filePath); // Verify file exists
        await updateMetadata(filePath, metadata);
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify({
                message: "Metadata updated successfully",
                file: docFile,
                metadata: state.metadata[docFile]
              }, null, 2)
            }
          ]
        };
      } catch (error: unknown) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        throw new McpError(
          ErrorCode.InternalError,
          `Error updating metadata: ${errorMessage}`
        );
      }
    }
  • Input schema definition for the update_metadata tool, including parameters projectPath, docFile, and metadata object.
    {
      name: "update_metadata",
      description: "Update metadata for a documentation file",
      inputSchema: {
        type: "object",
        properties: {
          projectPath: {
            type: "string",
            description: "Path to the project root directory"
          },
          docFile: {
            type: "string",
            description: "Name of the documentation file"
          },
          metadata: {
            type: "object",
            description: "Metadata to update",
            properties: {
              title: { type: "string" },
              category: { type: "string" },
              tags: { type: "array", items: { type: "string" } }
            }
          }
        },
        required: ["projectPath", "docFile", "metadata"]
      }
    },
  • Helper function that updates the global state.metadata for a document by merging provided partial metadata and setting lastUpdated timestamp.
    const updateMetadata = async (filePath: string, metadata: Partial<DocMetadata>) => {
      const fileName = filePath.split('/').pop() as string;
      state.metadata[fileName] = {
        ...state.metadata[fileName],
        ...metadata,
        lastUpdated: new Date().toISOString()
      } as DocMetadata;
    };
  • src/index.ts:530-556 (registration)
    Tool registration entry in the ListTools response, defining name, description, and inputSchema.
    {
      name: "update_metadata",
      description: "Update metadata for a documentation file",
      inputSchema: {
        type: "object",
        properties: {
          projectPath: {
            type: "string",
            description: "Path to the project root directory"
          },
          docFile: {
            type: "string",
            description: "Name of the documentation file"
          },
          metadata: {
            type: "object",
            description: "Metadata to update",
            properties: {
              title: { type: "string" },
              category: { type: "string" },
              tags: { type: "array", items: { type: "string" } }
            }
          }
        },
        required: ["projectPath", "docFile", "metadata"]
      }
    },
Behavior2/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. While 'Update' implies a mutation operation, it doesn't specify whether this requires specific permissions, if changes are reversible, what happens to existing metadata not mentioned, or any rate limits or side effects. This is inadequate for a mutation tool with zero annotation coverage.

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 directly states the tool's purpose without any wasted words. It's appropriately sized and front-loaded, making it easy for an agent to parse quickly.

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

Completeness2/5

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

Given that this is a mutation tool with no annotations and no output schema, the description is insufficiently complete. It lacks critical behavioral details (e.g., permissions, reversibility) and doesn't explain what the tool returns, leaving significant gaps for an agent to operate safely and effectively.

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?

The schema description coverage is 100%, so the schema already documents all three parameters (projectPath, docFile, metadata) and their nested structure. The description adds no additional semantic context beyond what's in the schema, such as examples or constraints, meeting the baseline for high schema coverage.

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

Purpose4/5

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

The description clearly states the action ('Update') and resource ('metadata for a documentation file'), making the purpose immediately understandable. However, it doesn't differentiate this tool from sibling tools like 'update_doc', leaving some ambiguity about when to use one versus the other.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like 'update_doc' or other sibling tools. There's no mention of prerequisites, context, or exclusions, leaving the agent to guess based on tool names alone.

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

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/ryanjoachim/mcp-rtfm'

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