get_type_details
Retrieve the fields of a specified GraphQL type to construct accurate field selections for queries.
Instructions
Get fields of a specific GraphQL type to know what to put in __fields
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| typeName | Yes | GraphQL type name, e.g. 'Machine', 'WorkOrder', 'Shift' |
Implementation Reference
- src/index.ts:312-312 (registration)Registration of the 'get_type_details' tool via server.tool()
"get_type_details", - src/index.ts:314-318 (schema)Zod schema for the tool's input parameter: typeName (string)
{ typeName: z .string() .describe("GraphQL type name, e.g. 'Machine', 'WorkOrder', 'Shift'"), }, - src/index.ts:319-348 (handler)Handler function that executes the tool logic: queries GraphQL __type introspection and returns fields
async ({ typeName }) => { const query = ` query GetType($name: String!) { __type(name: $name) { name kind description fields { name description type { kind name ofType { kind name ofType { kind name } } } } inputFields { name description type { kind name ofType { kind name } } } enumValues { name description } } } `; try { const data = await client.request(query, { name: typeName }); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }], }; } catch (err) { const msg = err instanceof Error ? err.message : String(err); return { content: [{ type: "text", text: `Error: ${msg}` }], isError: true, }; } }