Skip to content

[Bug]: ctx_search rejects singular 'query' param despite schema declaring it valid #1200

Description

@Crash371

Bug Description

ctx_search returns Error: provide query or queries. when called with the singular query parameter, even though the MCP tool schema declares query as a valid (non-required) string parameter alongside queries (array).

Reproduction

Call ctx_search with { query: "some search", limit: 5 } — the server responds with an error instead of performing the search.

Using { queries: ["some search"], limit: 5 } works correctly.

Root Cause (from source analysis)

In server.bundle.mjs v1.0.169, the validation logic checks only r.query:

// Extracted from server.bundle.mjs
if (r.query), o.length === 0) return W("ctx_search", {
  content: [{ type: "text", text: "Error: provide query or queries." }],
  isError: true
});

The code builds the query array o from r.queries but the fallback to r.query (singular) appears to not populate o, so the length check fails and the error is returned.

Expected Behavior

When query (singular string) is provided, it should be treated as equivalent to queries: [query] per the schema contract.

Environment

  • context-mode version: v1.0.169
  • Platform: Linux (Claude Code CLI)
  • MCP host: Claude Code

Workaround

Always use queries (array) instead of query (string).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions