get_model
Retrieve detailed information about a specific AI model from OpenAI, Anthropic, or Google using the Model Hub MCP interface for streamlined access.
Instructions
Get details of a specific model from a provider
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model_id | Yes | The model ID to fetch details for | |
| provider | Yes | The AI provider |
Input Schema (JSON Schema)
{
"properties": {
"model_id": {
"description": "The model ID to fetch details for",
"type": "string"
},
"provider": {
"description": "The AI provider",
"enum": [
"openai",
"anthropic",
"google"
],
"type": "string"
}
},
"required": [
"provider",
"model_id"
],
"type": "object"
}
Implementation Reference
- src/index.ts:138-187 (handler)Primary handler for the 'get_model' tool in the CallToolRequestHandler. Dispatches to provider-specific getModel methods based on the provider argument and returns the model details as JSON-formatted text.case 'get_model': { const { provider, model_id } = args as { provider: string; model_id: string }; switch (provider) { case 'openai': if (!openaiProvider) { throw new McpError(ErrorCode.InvalidRequest, 'OpenAI API key not configured'); } const openaiModel = await openaiProvider.getModel(model_id); return { content: [ { type: 'text', text: JSON.stringify(openaiModel, null, 2), }, ], }; case 'anthropic': if (!anthropicProvider) { throw new McpError(ErrorCode.InvalidRequest, 'Anthropic API key not configured'); } const anthropicModel = await anthropicProvider.getModel(model_id); return { content: [ { type: 'text', text: JSON.stringify(anthropicModel, null, 2), }, ], }; case 'google': if (!googleProvider) { throw new McpError(ErrorCode.InvalidRequest, 'Google API key not configured'); } const googleModel = await googleProvider.getModel(model_id); return { content: [ { type: 'text', text: JSON.stringify(googleModel, null, 2), }, ], }; default: throw new McpError(ErrorCode.InvalidRequest, `Unknown provider: ${provider}`); } }
- src/index.ts:51-69 (registration)Tool registration in the ListToolsRequestHandler, defining the name, description, and input schema for 'get_model'.{ name: 'get_model', description: 'Get details of a specific model from a provider', inputSchema: { type: 'object', properties: { provider: { type: 'string', enum: ['openai', 'anthropic', 'google'], description: 'The AI provider', }, model_id: { type: 'string', description: 'The model ID to fetch details for', }, }, required: ['provider', 'model_id'], }, },
- src/providers/openai.ts:36-52 (helper)OpenAI provider's getModel method, called by the main handler for OpenAI models. Fetches model details via OpenAI API.async getModel(modelId: string): Promise<OpenAIModel> { try { const response = await axios.get(`${this.baseURL}/models/${modelId}`, { headers: { 'Authorization': `Bearer ${this.apiKey}`, 'Content-Type': 'application/json' } }); return response.data; } catch (error) { if (axios.isAxiosError(error)) { throw new Error(`OpenAI API error: ${error.response?.data?.error?.message || error.message}`); } throw error; } }
- src/providers/anthropic.ts:37-54 (helper)Anthropic provider's getModel method, called by the main handler for Anthropic models. Fetches model details via Anthropic API.async getModel(modelId: string): Promise<AnthropicModel> { try { const response = await axios.get(`${this.baseURL}/models/${modelId}`, { headers: { 'x-api-key': this.apiKey, 'anthropic-version': '2023-06-01', 'Content-Type': 'application/json' } }); return response.data; } catch (error) { if (axios.isAxiosError(error)) { throw new Error(`Anthropic API error: ${error.response?.data?.error?.message || error.message}`); } throw error; } }
- src/providers/google.ts:39-54 (helper)Google provider's getModel method, called by the main handler for Google models. Fetches model details via Google AI API.async getModel(modelId: string): Promise<GoogleModel> { try { const response = await axios.get(`${this.baseURL}/models/${modelId}`, { params: { key: this.apiKey } }); return response.data; } catch (error) { if (axios.isAxiosError(error)) { throw new Error(`Google AI API error: ${error.response?.data?.error?.message || error.message}`); } throw error; } }