Skip to main content
Glama
johnreitano

MCP Datastore Server

by johnreitano

datastore_get

Retrieve a specific entity from Google Cloud Datastore using its key and kind, with optional parent key for hierarchical data structures.

Instructions

Get an entity by its key

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYesThe entity key (name or ID)
kindYesThe entity kind
parentNoParent key if the entity has a parent (optional)

Implementation Reference

  • Core implementation of the datastore_get tool logic: retrieves an entity from Google Cloud Datastore by constructing the key (handling numeric/ID or string name, optional parent) and fetching it.
    async getEntity(kind: string, key: string, parent?: string): Promise<any> {
      try {
        let entityKey;
        
        const keyValue = isNaN(Number(key)) ? key : parseInt(key);
        if (parent) {
          const parentKeyValue = isNaN(Number(parent)) ? parent : parseInt(parent);
          entityKey = this.datastore.key([kind, parentKeyValue, kind, keyValue]);
        } else {
          entityKey = this.datastore.key([kind, keyValue]);
        }
    
        const [entity] = await this.datastore.get(entityKey);
        
        if (!entity) {
          return null;
        }
    
        return {
          key: entity[this.datastore.KEY],
          ...entity,
        };
      } catch (error) {
        throw new Error(`Failed to get entity: ${error instanceof Error ? error.message : 'Unknown error'}`);
      }
    }
  • Input schema for the datastore_get tool defining required 'kind' and 'key' parameters, optional 'parent'.
    inputSchema: {
      type: 'object',
      properties: {
        kind: {
          type: 'string',
          description: 'The entity kind',
        },
        key: {
          type: 'string',
          description: 'The entity key (name or ID)',
        },
        parent: {
          type: 'string',
          description: 'Parent key if the entity has a parent (optional)',
        },
      },
      required: ['kind', 'key'],
    },
  • src/index.ts:36-57 (registration)
    Registration of the datastore_get tool in the MCP listTools response.
    {
      name: 'datastore_get',
      description: 'Get an entity by its key',
      inputSchema: {
        type: 'object',
        properties: {
          kind: {
            type: 'string',
            description: 'The entity kind',
          },
          key: {
            type: 'string',
            description: 'The entity key (name or ID)',
          },
          parent: {
            type: 'string',
            description: 'Parent key if the entity has a parent (optional)',
          },
        },
        required: ['kind', 'key'],
      },
    },
  • MCP callTool handler case for datastore_get: calls DatastoreClient.getEntity and returns text response with JSON or not found message.
    case 'datastore_get':
      const entity = await datastoreClient.getEntity(
        args.kind as string,
        args.key as string,
        args.parent as string | undefined
      );
      return {
        content: [
          {
            type: 'text',
            text: entity ? JSON.stringify(entity, null, 2) : 'Entity not found',
          },
        ],
      };
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 states the tool gets an entity, implying a read operation, but lacks details on permissions, error handling (e.g., if the key doesn't exist), rate limits, or return format. This is a significant gap for a tool with no annotation coverage.

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 with zero waste. It's front-loaded and appropriately sized for the tool's purpose.

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 no annotations, no output schema, and 3 parameters, the description is incomplete. It doesn't cover behavioral aspects like error cases or return values, leaving gaps for an agent to use the tool effectively in a datastore context with siblings like datastore_query.

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 (key, kind, parent) with descriptions. The description adds minimal value beyond implying key-based retrieval, aligning with the schema but not providing additional syntax or format details.

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 'Get an entity by its key' clearly states the action (get) and resource (entity), specifying the key as the identifier. It distinguishes from siblings like datastore_count (counting) and datastore_query (querying), but doesn't explicitly differentiate from datastore_filter (which might also retrieve entities).

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?

No guidance is provided on when to use this tool versus alternatives like datastore_filter or datastore_query. The description implies it's for direct key-based retrieval, but there's no explicit context, exclusions, or prerequisites mentioned.

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