Skip to main content
Glama
johnreitano

MCP Datastore Server

by johnreitano

datastore_filter

Filter entities stored in Google Cloud Datastore by exact field matches. Specify kind, field, and value to retrieve filtered results efficiently.

Instructions

Query entities with a simple equality filter on any field

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fieldYesThe field name to filter on (can be key field or property)
kindYesThe entity kind to query
limitNoMaximum number of results to return (default: 100)
valueYesThe value to match exactly

Implementation Reference

  • Core implementation of the datastore_filter tool: creates a Google Cloud Datastore query filtered by the specified field and value, applies limit, and maps results to include keys.
    async filterEntities(kind: string, field: string, value: string, limit = 100): Promise<any[]> {
      try {
        let query = this.datastore.createQuery(kind);
    
        if (field === '__key__' || field === 'key') {
          const keyValue = isNaN(Number(value)) ? value : parseInt(value);
          const entityKey = this.datastore.key([kind, keyValue]);
          query = query.filter('__key__', '=', entityKey);
        } else {
          const convertedValue = this.convertValue(value);
          query = query.filter(field, '=', convertedValue);
        }
    
        query = query.limit(limit);
    
        const [entities] = await this.datastore.runQuery(query);
        
        return entities.map(entity => ({
          key: entity[this.datastore.KEY],
          ...entity,
        }));
      } catch (error) {
        throw new Error(`Failed to filter entities: ${error instanceof Error ? error.message : 'Unknown error'}`);
      }
    }
  • Input schema definition for the datastore_filter tool, including parameters kind, field, value (required), and optional limit.
    {
      name: 'datastore_filter',
      description: 'Query entities with a simple equality filter on any field',
      inputSchema: {
        type: 'object',
        properties: {
          kind: {
            type: 'string',
            description: 'The entity kind to query',
          },
          field: {
            type: 'string',
            description: 'The field name to filter on (can be key field or property)',
          },
          value: {
            type: 'string',
            description: 'The value to match exactly',
          },
          limit: {
            type: 'number',
            description: 'Maximum number of results to return (default: 100)',
          },
        },
        required: ['kind', 'field', 'value'],
      },
    },
  • Handler case in the CallToolRequestHandler that invokes the DatastoreClient.filterEntities method and formats the response as text content.
    case 'datastore_filter':
      const filteredResults = await datastoreClient.filterEntities(
        args.kind as string,
        args.field as string,
        args.value as string,
        args.limit as number | undefined
      );
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(filteredResults, null, 2),
          },
        ],
      };
  • Helper method used in filterEntities to convert string input value to appropriate type (boolean, number, null, or string) for Datastore filter.
      private convertValue(value: string): any {
        if (value.toLowerCase() === 'true') return true;
        if (value.toLowerCase() === 'false') return false;
        if (value.toLowerCase() === 'null') return null;
        
        const numValue = Number(value);
        if (!isNaN(numValue)) return numValue;
        
        return value;
      }
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It mentions the query behavior ('simple equality filter'), but lacks details on permissions, rate limits, error handling, or what happens with no matches. For a query tool with zero annotation coverage, this leaves significant behavioral gaps.

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's appropriately sized and front-loaded, making it easy to understand quickly.

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 tool's complexity (query operation with 4 parameters), lack of annotations, and no output schema, the description is incomplete. It doesn't cover return values, error cases, or usage context, leaving the agent with insufficient information for reliable invocation.

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?

Schema description coverage is 100%, so the schema already documents all parameters (field, kind, limit, value). The description adds minimal value by implying the parameters are used for filtering, but doesn't provide additional context like examples or constraints beyond what's in the schema.

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 tool's purpose with a specific verb ('Query') and resource ('entities'), and specifies the filtering mechanism ('simple equality filter on any field'). It distinguishes from siblings like datastore_count (counting) and datastore_get (retrieving by key), but doesn't explicitly differentiate from datastore_query, which might offer more complex queries.

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 like datastore_query or datastore_list_kinds. It mentions the filtering type ('simple equality filter'), but doesn't specify scenarios where this is preferred over more complex queries or when it's insufficient.

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

Related 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/johnreitano/daisy'

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