Skip to main content
Glama
Pinecone Read-Only MCP

Pinecone Read-Only MCP

by cppalliance

count

Returns the number of unique documents matching a metadata filter and semantic query, so users can answer “how many documents by author X or tagged Y?”

Instructions

Get the number of unique documents matching a metadata filter and semantic query. Use when the user asks for a count (e.g. "how many documents by author X?", "how many records tagged Y?"). Uses semantic (dense) search only and requests only document identifiers (no content) for performance. Returns the number of unique documents (deduped by document_number/url/doc_id) up to 10,000; truncated=true if at least that many. Mandatory flow: call suggest_query_params first, then count. Use list_namespaces to discover namespace and metadata fields. For count-by-metadata only, use a broad query_text (e.g. "document" or "record"). Same metadata_filter operators as query: $eq, $ne, $gt, $gte, $lt, $lte, $in, $nin, $and, $or.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "namespace": "<namespace>",
      "query_text": "<query_text>"
    },
    "name": "count"
  }
}

Input Schema

NameRequiredDescriptionDefault
sourceNoPinecone source name (from list_sources). Omit on discovery tools to search all sources. On query tools, omit only when namespace uniquely identifies one source.
namespaceYesNamespace to count in. Use list_namespaces to discover namespaces.
query_textYesSearch query text. Use a broad term (e.g. "document", "record") when counting by metadata only.
metadata_filterNoOptional metadata filter. Use exact field names from list_namespaces. E.g. {"author": {"$in": ["Alex Doe", "A. Doe"]}} to count by author.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.5.0

TDQS

A4.8/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations supplied, the description carries the full burden and does so: it discloses that only semantic/dense search is used, that only identifiers are fetched (no content) for performance, that results are deduped by document_number/url/doc_id, and that there is a 10,000 ceiling with a truncated=true signal. These are exactly the operational traits an agent could not infer from the schema.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The purpose and the usage trigger come first, followed by behavioral facts and then the prerequisite/workflow guidance, which is the right ordering. Some sentences are dense and pack multiple facts (dedup keys, cap, truncated flag), but no sentence is idle padding.

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

Completeness5/5

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

There is no output schema, and the description compensates by stating the return value, its dedup basis, and its truncation behavior. Combined with the mandatory call ordering and discovery pointers, an agent has everything needed to invoke this correctly on the first attempt.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the baseline is 3; the description adds real meaning beyond the schema by enumerating the supported metadata_filter operators ($eq through $or) and by telling the caller to pass a broad query_text when filtering by metadata alone. The source parameter's omission semantics are left to the schema, which already documents them.

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?

"Get the number of unique documents matching a metadata filter and semantic query" states a specific verb (count) and resource (documents) and implicitly distinguishes itself from the retrieval-oriented siblings like query/keyword_search. The dedup rule and the 10,000 cap make the returned value unambiguous.

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

Usage Guidelines5/5

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

It explicitly names the triggering user phrasing ("how many documents by author X?"), declares a mandatory prerequisite flow (suggest_query_params first, then count), points to list_namespaces for discovery, and gives the metadata-only pattern with a broad query_text. Alternatives and preconditions are both covered.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.