get_function_details
Retrieve detailed information about a specific function, including provider reputation metrics, by providing its function ID (fid).
Instructions
Get detailed information about a specific function including provider reputation metrics. Provide the function ID (fid) to look up.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fid | Yes | The function ID (fid) to look up |
Implementation Reference
- src/tools/discovery.ts:41-71 (handler)The main handler implementation for get_function_details. Takes a function ID (fid), lists all functions to find the matching one, fetches provider reputation for that function, and returns both the function details and provider reputation as JSON.
async (params) => { // List functions and find the matching one const allFunctions = await client.listFunctions(); const fn = Array.isArray(allFunctions) ? allFunctions.find((f: any) => f.fid === params.fid) : null; if (!fn) { return { content: [{ type: 'text' as const, text: `Function "${params.fid}" not found.` }], isError: true, }; } // Also fetch provider reputation let reputation = null; try { reputation = await client.getReputation(fn.provider.agentId, { functionId: params.fid, }); } catch { // Reputation may not be available yet } return { content: [{ type: 'text' as const, text: JSON.stringify({ function: fn, providerReputation: reputation }, null, 2), }], }; } - src/tools/discovery.ts:37-39 (schema)Input schema definition for get_function_details tool. Defines a single required parameter 'fid' (string) which is the function ID to look up.
{ fid: z.string().describe('The function ID (fid) to look up'), }, - src/tools/discovery.ts:34-72 (registration)Complete registration of the get_function_details tool with the MCP server. Includes the tool name, description, input schema, hints (readOnlyHint, openWorldHint), and the async handler function.
server.tool( 'get_function_details', 'Get detailed information about a specific function including provider reputation metrics. Provide the function ID (fid) to look up.', { fid: z.string().describe('The function ID (fid) to look up'), }, { readOnlyHint: true, openWorldHint: true }, async (params) => { // List functions and find the matching one const allFunctions = await client.listFunctions(); const fn = Array.isArray(allFunctions) ? allFunctions.find((f: any) => f.fid === params.fid) : null; if (!fn) { return { content: [{ type: 'text' as const, text: `Function "${params.fid}" not found.` }], isError: true, }; } // Also fetch provider reputation let reputation = null; try { reputation = await client.getReputation(fn.provider.agentId, { functionId: params.fid, }); } catch { // Reputation may not be available yet } return { content: [{ type: 'text' as const, text: JSON.stringify({ function: fn, providerReputation: reputation }, null, 2), }], }; } ); - src/client.ts:109-117 (helper)Helper method listFunctions() called by get_function_details handler. Makes an API request to /functions endpoint with optional query parameters (q, minPrice, maxPrice, sort, provider).
async listFunctions(params?: { q?: string; minPrice?: number; maxPrice?: number; sort?: string; provider?: string; }): Promise<any> { return this.request('/functions', { params: params as any }); } - src/client.ts:123-129 (helper)Helper method getReputation() called by get_function_details handler. Makes an API request to /agents/{agentId}/reputation endpoint with optional functionId, dateFrom, and dateTo parameters to fetch provider reputation metrics.
async getReputation(agentId: string, params?: { functionId?: string; dateFrom?: string; dateTo?: string; }): Promise<any> { return this.request(`/agents/${agentId}/reputation`, { params: params as any }); }