getFilterValues
Retrieve specific filter values from the mcp-comexstat server to streamline data queries. Input a filter and language to extract relevant information for analysis or processing.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filter | Yes | ||
| language | No |
Implementation Reference
- src/ComexstatClient.ts:181-195 (handler)Core handler function that fetches filter values from the Comexstat API endpoint `/general/filters/${filter}` and extracts the first array of {id, text} objects.async getFilterValues( filter: string, language: string = "pt" ): Promise<Array<{ id: string; text: string }>> { const response = await this.get<{ data: Array<Array<{ id: string; text: string }>>; success: boolean; message: string | null; processo_info: any; language: string; }>(`/general/filters/${filter}`, { language }); // The API returns an array of arrays, but we only need the first array return response.data[0]; }
- src/ComexstatMCP.ts:52-68 (registration)Registers the 'getFilterValues' tool with the MCP server, providing input schema and a handler that delegates to ComexstatClient.getFilterValues and returns JSON-formatted response as text content.this.server.tool( "getFilterValues", { filter: z.string(), language: z.string().optional(), }, async ({ filter, language }) => ({ content: [ { type: "text", text: JSON.stringify( await this.client.getFilterValues(filter, language) ), }, ], }) );
- src/ComexstatMCP.ts:54-57 (schema)Zod schema defining the input parameters for the getFilterValues tool: required 'filter' string and optional 'language' string.{ filter: z.string(), language: z.string().optional(), },