get_record
Retrieve a specific Gadget app record by providing the model name, record ID, and desired fields to return via GraphQL query.
Instructions
Get a single Gadget record by ID. Specify the model name, record ID, and fields to return.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model | Yes | Model name in camelCase, e.g. shopifyOrder, label | |
| id | Yes | Record ID | |
| fields | Yes | GraphQL field selection, e.g. "id name email createdAt" |
Implementation Reference
- src/tools.ts:125-136 (handler)The `get_record` tool handler, which fetches a single Gadget record by ID using a dynamically constructed GraphQL query.
case "get_record": { const { model, id, fields } = args as { model: string; id: string; fields: string }; const query = ` query GetRecord($id: GadgetID!) { ${model}(id: $id) { ${fields} } } `; const data = await gql(query, { id }); return { content: [{ type: "text", text: JSON.stringify(data[model], null, 2) }] }; } - src/tools.ts:206-217 (schema)The JSON schema definition for the `get_record` tool, specifying input parameters: model, id, and fields.
name: "get_record", description: "Get a single Gadget record by ID. Specify the model name, record ID, and fields to return.", inputSchema: { type: "object", required: ["model", "id", "fields"], properties: { model: { type: "string", description: "Model name in camelCase, e.g. shopifyOrder, label" }, id: { type: "string", description: "Record ID" }, fields: { type: "string", description: "GraphQL field selection, e.g. \"id name email createdAt\"" }, }, }, },