Skip to main content
Glama
christophersutton

InstantDB MCP Server

returnQuery.ts855 B
import { z } from 'zod'; import { Server } from '@modelcontextprotocol/sdk/server/index.js'; import { queryStore, Query } from '../utils/queries.js'; import { McpError, ErrorCode } from '@modelcontextprotocol/sdk/types.js'; export function registerReturnQuery(server: Server) { const ReturnQuerySchema = z.object({ method: z.literal("return_query"), id: z.string() }); server.setRequestHandler(ReturnQuerySchema, async (request) => { const { id } = request; console.error('[Tool] return_query called with id:', id); if (!id) { throw new McpError(ErrorCode.InvalidParams, 'The "id" parameter is required'); } const foundQuery: Query | undefined = queryStore.getQuery(id); if (!foundQuery) { throw new McpError(ErrorCode.InvalidParams, 'Query not found'); } return { content: foundQuery }; }); }

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/christophersutton/instantdb-mcp'

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