Skip to main content
Glama
vjsr007
by vjsr007

image-get

Retrieve images by ID or key and optionally include base64 data. Simplify image access and management on the MCP Index Notes server for enhanced note organization and retrieval.

Instructions

Retrieve images by id or key. Optionally include base64 data.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idNo
includeDataNo
keyNo
limitNo

Implementation Reference

  • Main handler logic for the 'image-get' tool within the CallToolRequestSchema request handler. Parses input using ImageGetSchema, checks store support, calls appropriate DB methods (getImageById or getImagesByKey), and returns JSON serialized results.
    case 'image-get': {
      const parsed = ImageGetSchema.parse(args ?? {});
      if (!('getImageById' in (db as any))) {
        throw new Error('Image storage not supported in current store implementation');
      }
      let result: any = null;
      if (parsed.id) {
        result = (db as any).getImageById(parsed.id, parsed.includeData);
      } else if (parsed.key) {
        result = (db as any).getImagesByKey(parsed.key, parsed.limit, parsed.includeData);
      } else {
        result = [];
      }
      return { content: [{ type: 'text', text: JSON.stringify(result) }] };
    }
  • src/mcp.ts:77-88 (registration)
    Tool registration in the tools array exported for ListToolsRequestSchema. Defines name 'image-get', description, and input schema structure.
      name: 'image-get',
      description: 'Retrieve images by id or key. Optionally include base64 data.',
      inputSchema: {
        type: 'object',
        properties: {
          id: { type: 'number' },
          key: { type: 'string' },
          limit: { type: 'number' },
          includeData: { type: 'boolean' },
        },
      },
    },
  • Zod schema ImageGetSchema used for input validation in the handler. Defines optional id, key, limit (default 10, max 50), includeData (default false). Type alias ImageGetInput.
    export const ImageGetSchema = z.object({
      id: z.number().int().positive().optional(),
      key: z.string().optional(),
      limit: z.number().int().positive().max(50).optional().default(10),
      includeData: z.boolean().optional().default(false),
    });
    export type ImageGetInput = z.infer<typeof ImageGetSchema>;
  • Core helper function getImagesByKey in NotesDB class. Queries images table by key, optionally includes data BLOB, converts rows to ImageRecord using rowToImage.
    getImagesByKey(key: string, limit = 10, includeData = false): ImageRecord[] {
      const rows = this.db
        .prepare(`SELECT id, key, mime, size, metadata, created_at ${includeData ? ', data' : ''} FROM images WHERE key = ? ORDER BY created_at DESC LIMIT ?`)
        .all(key, limit);
      return rows.map((r: any) => this.rowToImage(r, includeData));
    }
  • Core helper function getImageById in NotesDB class. Retrieves single image by id, optionally includes data BLOB, converts to ImageRecord.
    getImageById(id: number, includeData = false): ImageRecord | null {
      const row = this.db
        .prepare(`SELECT id, key, mime, size, metadata, created_at ${includeData ? ', data' : ''} FROM images WHERE id = ?`)
        .get(id);
      return row ? this.rowToImage(row, includeData) : null;
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions the optional base64 data inclusion but doesn't address critical behaviors like authentication requirements, rate limits, error conditions, pagination (despite having a 'limit' parameter), or whether this is a read-only operation. The description is insufficient for a tool with 4 parameters and 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.

Conciseness4/5

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

The description is appropriately concise with two clear sentences that front-load the main purpose. Every phrase adds value: the first establishes core functionality, the second adds an important optional feature. No wasted words or redundancy.

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 has 4 parameters with 0% schema coverage, no annotations, and no output schema, the description is incomplete. It doesn't explain what the tool returns (beyond mentioning base64 data as optional), how results are structured, error handling, or the relationship between parameters. For a retrieval tool with multiple parameters, this leaves significant gaps.

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

Parameters2/5

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

With 0% schema description coverage and 4 parameters, the description fails to compensate adequately. It only mentions 'id or key' and 'include base64 data', leaving 'limit' completely undocumented and providing no context about parameter relationships (e.g., whether id and key are mutually exclusive, what 'limit' applies to, or format requirements for 'key').

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 verb 'Retrieve' and resource 'images', specifying it can be done 'by id or key'. It distinguishes from siblings like image-delete and image-upsert by focusing on retrieval rather than modification. However, it doesn't explicitly differentiate from image-export which might also retrieve images.

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 image-export or image-upsert. It mentions the optional 'include base64 data' feature but doesn't explain when this would be beneficial or necessary compared to other retrieval methods.

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

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/vjsr007/mcp-index-notes'

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