Skip to main content
Glama

quip_replace_content

Replace existing content in Quip documents with new markdown content using the document's thread ID.

Instructions

Replace content in an existing Quip document

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
threadIdYesThe Quip document thread ID
contentYesNew markdown content to replace the document content

Implementation Reference

  • src/index.ts:101-118 (registration)
    Registration of the 'quip_replace_content' tool in the ListToolsRequestSchema handler, including name, description, and input schema.
    {
      name: 'quip_replace_content',
      description: 'Replace content in an existing Quip document',
      inputSchema: {
        type: 'object',
        properties: {
          threadId: {
            type: 'string',
            description: 'The Quip document thread ID'
          },
          content: {
            type: 'string',
            description: 'New markdown content to replace the document content'
          }
        },
        required: ['threadId', 'content'],
      },
    },
  • Input schema for the quip_replace_content tool, defining required threadId and content parameters.
    inputSchema: {
      type: 'object',
      properties: {
        threadId: {
          type: 'string',
          description: 'The Quip document thread ID'
        },
        content: {
          type: 'string',
          description: 'New markdown content to replace the document content'
        }
      },
      required: ['threadId', 'content'],
    },
  • Specific handler case in the CallToolRequestSchema switch for 'quip_replace_content', validating inputs and delegating to editDocument helper with 'REPLACE' operation.
    case 'quip_replace_content': {
      const typedArgs = args as any;
      if (!typedArgs.threadId || !typedArgs.content) {
        throw new McpError(ErrorCode.InvalidParams, 'threadId and content are required');
      }
      return await this.editDocument(String(typedArgs.threadId), String(typedArgs.content), 'REPLACE');
    }
  • editDocument helper method implementing the core logic for replacing document content by invoking the quip_edit.py script with REPLACE operation.
    private async editDocument(threadId: string, content: string, operation: string) {
      try {
        console.log(`Editing document ${threadId} with operation ${operation}...`);
        
        // Create a temporary file to store the content
        const tempFilePath = `/tmp/quip_content_${Date.now()}.md`;
        const writeCommand = `echo "${content.replace(/"/g, '\\"')}" > ${tempFilePath}`;
        await execAsync(writeCommand);
        
        // Execute the Python script to edit the document
        const command = `python -u ${path.join(SCRIPTS_DIR, 'quip_edit.py')} ${threadId} ${operation.toLowerCase()} ${tempFilePath}`;
        const { stdout, stderr } = await execAsync(command);
        
        // Clean up the temporary file
        await execAsync(`rm ${tempFilePath}`);
        
        if (stderr) {
          console.error(`Error editing document: ${stderr}`);
          throw new Error(stderr);
        }
    
        return {
          content: [
            {
              type: 'text',
              text: stdout || `Successfully ${operation.toLowerCase()}ed content to document ${threadId}`,
            },
          ],
        };
      } catch (error) {
        console.error(`Error ${operation.toLowerCase()}ing document:`, error);
        throw error;
      }
    }
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. It states the tool replaces content, implying a mutation operation, but lacks details on permissions required, whether changes are reversible, rate limits, or error handling. For a write tool with zero annotation coverage, this leaves significant gaps in understanding its behavior and risks.

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 function without unnecessary words. It is front-loaded with the core action and resource, making it easy to parse quickly. Every part of the sentence earns its place by conveying essential information.

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 the complexity of a mutation tool with no annotations and no output schema, the description is incomplete. It doesn't address behavioral aspects like side effects, return values, or error conditions. While the schema covers parameters well, the overall context for safe and effective use is lacking, especially for a tool that modifies existing resources.

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%, with both parameters ('threadId' and 'content') clearly documented in the input schema. The description adds no additional meaning beyond what the schema provides, such as format examples or constraints. Since the schema does the heavy lifting, the baseline score of 3 is appropriate, as the description doesn't compensate but also doesn't detract.

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 ('Replace content') and target resource ('in an existing Quip document'), making the purpose immediately understandable. It distinguishes itself from siblings like 'quip_append_content' and 'quip_prepend_content' by specifying replacement rather than addition. However, it doesn't explicitly contrast with 'quip_read_document' or 'quip_create_document', keeping it from a perfect score.

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. It doesn't mention prerequisites (e.g., needing an existing document), exclusions (e.g., not for new documents), or comparisons to siblings like 'quip_append_content' for adding content without replacement. Without such context, users must infer usage from the tool name 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

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/AvinashBole/quip-mcp-server'

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