obtener-setup
Retrieve setup information from Chop's system using a specific setup ID through the MCP server's REST API interface.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| setup_id | Yes | El id del setup a obtener |
Implementation Reference
- main.ts:17-32 (handler)The tool handler that takes a setup_id, fetches the setup data via HTTP GET from http://localhost:8080/backoffice/setup/${setup_id}, and returns the JSON-stringified response in a text content block.async ({ setup_id }) => { const url = `http://localhost:8080/backoffice/setup/${setup_id}`; const response = await axios.get<Setup>(url, { headers: { 'Content-Type': 'application/json' } }); return { content: [{ type: 'text', text: JSON.stringify(response.data, null, 2) }] }; }
- main.ts:14-16 (schema)Input schema for the tool, requiring a numeric setup_id with description.{ setup_id: z.number().describe('El id del setup a obtener') },
- main.ts:12-33 (registration)Registration of the 'obtener-setup' tool on the MCP server, specifying the tool name, input schema using Zod, and the handler function.server.tool( "obtener-setup", { setup_id: z.number().describe('El id del setup a obtener') }, async ({ setup_id }) => { const url = `http://localhost:8080/backoffice/setup/${setup_id}`; const response = await axios.get<Setup>(url, { headers: { 'Content-Type': 'application/json' } }); return { content: [{ type: 'text', text: JSON.stringify(response.data, null, 2) }] }; } );
- types.ts:1-13 (schema)TypeScript interface defining the Setup type used for typing the API response in the handler.export interface Setup { id: number; site_id: string; origin: string; entity_type: string; entity_type_id: string; collector_id: number; created_by: string; expired_at: string | null; internal_detail: InternalDetail; external_detail: Record<string, any> | null; created_at: string; }