Skip to main content
Glama
johnreitano

MCP Datastore Server

by johnreitano

datastore_query

Execute queries on Google Cloud Datastore entities with optional filters, pagination, and equality conditions to retrieve specific data sets efficiently.

Instructions

Execute a query on entities with optional filters

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
kindYesThe entity kind to query
limitNoMaximum number of results to return (default: 100)
offsetNoNumber of results to skip (default: 0)

Implementation Reference

  • The main handler function that executes the datastore_query tool logic, creating and running a Google Cloud Datastore query for the given kind with optional limit and offset.
    async queryEntities(kind: string, limit = 100, offset = 0): Promise<any[]> {
      try {
        const query = this.datastore.createQuery(kind)
          .limit(limit)
          .offset(offset);
    
        const [entities] = await this.datastore.runQuery(query);
        
        return entities.map(entity => ({
          key: entity[this.datastore.KEY],
          ...entity,
        }));
      } catch (error) {
        throw new Error(`Failed to query entities: ${error instanceof Error ? error.message : 'Unknown error'}`);
      }
    }
  • Input schema and metadata definition for the datastore_query tool, used in ListTools response.
    {
      name: 'datastore_query',
      description: 'Execute a query on entities with optional filters',
      inputSchema: {
        type: 'object',
        properties: {
          kind: {
            type: 'string',
            description: 'The entity kind to query',
          },
          limit: {
            type: 'number',
            description: 'Maximum number of results to return (default: 100)',
          },
          offset: {
            type: 'number',
            description: 'Number of results to skip (default: 0)',
          },
        },
        required: ['kind'],
      },
    },
  • src/index.ts:166-179 (registration)
    Dispatches the CallToolRequest for datastore_query to the queryEntities handler and formats the response.
    case 'datastore_query':
      const results = await datastoreClient.queryEntities(
        args.kind as string,
        args.limit as number | undefined,
        args.offset as number | undefined
      );
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(results, null, 2),
          },
        ],
      };
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