Skip to content

Bug: Calling non-existent tools returns synthetic context_info content instead of error #271

@peremajoral

Description

@peremajoral

Description

When calling a non-existent tool (e.g., mcp_context_info), instead of receiving a "tool not found" error, the system returns the synthetic context_info content (the prunable-tools list).

Steps to Reproduce

  1. Have DCP plugin installed and enabled
  2. Try to call any non-existent tool, e.g., mcp_context_info
  3. Instead of an error, you receive the <prunable-tools> list

Expected Behavior

Calling a non-existent tool should return an error like "tool not found" or similar.

Actual Behavior

The synthetic context_info tool output (containing the prunable-tools list) is returned, making it appear as if the tool "succeeded" but with unexpected content.

Root Cause

Found in lib/messages/utils.ts line 69:

// createSyntheticAssistantMessageWithToolPart function
return {
    parts: [{
        type: "tool",
        callID: SYNTHETIC_CALL_ID,
        tool: "context_info",  // <-- This synthetic tool name
        state: {
            status: "completed",
            output: content,  // <-- prunable-tools list
            title: "Context Info",
        },
    }],
}

The DCP plugin creates synthetic tool results with tool: "context_info" to inject the prunable-tools list into the conversation. When a user tries to call a non-existent tool, this synthetic content gets returned instead of a proper error.

Suggested Fix

Option 1: Rename the synthetic tool to something clearly internal, like:

  • _dcp_internal_context_info
  • __synthetic_context_info
  • dcp:context_info

Option 2: Prefix with underscore to indicate internal use: _context_info

This would prevent confusion when users accidentally try to call non-existent tools.

Environment

  • DCP version: latest (@tarquinen/opencode-dcp@latest)
  • OpenCode version: 1.0.216+

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions