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
| Name | Required | Description | Default |
|---|---|---|---|
| source | No | Pinecone source name (from list_sources). Omit on discovery tools to search all sources. On query tools, omit only when namespace uniquely identifies one source. | |
| namespace | Yes | Namespace to count in. Use list_namespaces to discover namespaces. | |
| query_text | Yes | Search query text. Use a broad term (e.g. "document", "record") when counting by metadata only. | |
| metadata_filter | No | Optional metadata filter. Use exact field names from list_namespaces. E.g. {"author": {"$in": ["Alex Doe", "A. Doe"]}} to count by author. |