fal-get-model-schema
Retrieve the input and output schema of any model by providing its modelId. Use this to understand the model's data structure and requirements for making valid requests.
Instructions
Get the schema for a model. The model schema is used to understand the input and output of the model. use the modelId to get the schema of the model.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| modelId | Yes |
Implementation Reference
- src/tools/index.ts:55-66 (handler)The tool handler for 'fal-get-model-schema'. Registers the tool with server.tool(), takes a modelId parameter, calls client.getModelSchema(), and returns the schema as text content.
server.tool( 'fal-get-model-schema', 'Get the schema for a model. The model schema is used to understand the input and output of the model. use the modelId to get the schema of the model.', { modelId: z.string(), }, async (args) => { const modelId = (args as any)?.modelId ?? (args as any)?.arguments?.modelId; const schema = await client.getModelSchema(modelId as any); return { content: [{ type: 'text', text: toText(schema) }] }; }, ); - src/services/fal-client.ts:45-52 (helper)The getModelSchema() method in FalClient that fetches the OpenAPI schema for a model from the fal.ai API endpoint.
async getModelSchema(modelId: string): Promise<unknown> { if (!modelId) { return { error: 'modelId is required' }; } const endpointId = this._normalizeModelId(modelId); const url = `${this.BASE_URL}/openapi/queue/openapi.json?endpoint_id=${encodeURIComponent(endpointId)}`; return await this._getJson(url); } - src/tools/index.ts:55-60 (schema)The input schema for the tool, defined inline with zod: takes a single required 'modelId' string parameter.
server.tool( 'fal-get-model-schema', 'Get the schema for a model. The model schema is used to understand the input and output of the model. use the modelId to get the schema of the model.', { modelId: z.string(), }, - src/tools/index.ts:6-6 (registration)The registerTools function exports the tool registration. Called from server/index.ts to register all tools including fal-get-model-schema.
export function registerTools(server: McpServer, token: string): void {