Skip to main content
Glama

get_model_schema

Retrieve detailed schema information for specific API models to analyze data structures and endpoints without loading entire OpenAPI specifications.

Instructions

Get detailed schema for a specific model

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
apiYesAPI name or direct URL
model_nameYesName of the model

Implementation Reference

  • Core handler function that retrieves the detailed schema for a specific model from the OpenAPI components.schemas section.
    async def get_model_schema(
        self, api_identifier: str, model_name: str
    ) -> Dict[str, Any]:
        """Get detailed schema for a specific model."""
        url, headers = self.config_manager.get_api_config(api_identifier)
        schema = await self.cache.get_schema(url, headers)
    
        components = schema.get("components", {})
        schemas = components.get("schemas", {})
    
        if model_name not in schemas:
            raise ValueError(f"Model '{model_name}' not found")
    
        logger.info(f"Retrieved schema for model {model_name}")
        return {"name": model_name, "schema": schemas[model_name]}
  • Defines the JSON Schema for the tool's input parameters, requiring 'api' and 'model_name'.
    def create_model_schema_input_schema() -> Dict[str, Any]:
        """Create input schema for model schema operations."""
        return {
            "type": "object",
            "properties": {
                "api": {"type": "string", "description": "API name or direct URL"},
                "model_name": {
                    "type": "string",
                    "description": "Name of the model",
                },
            },
            "required": ["api", "model_name"],
        }
  • Registers the GetModelSchemaTool instance in the tool registry along with other tools.
    tools = [
        # API Management Tools
        AddApiTool(self.config_manager),
        ListSavedApisTool(self.config_manager),
        RemoveApiTool(self.config_manager),
        # API Exploration Tools
        GetApiInfoTool(self.config_manager, self.explorer),
        ListEndpointsTool(self.config_manager, self.explorer),
        SearchEndpointsTool(self.config_manager, self.explorer),
        GetEndpointDetailsTool(self.config_manager, self.explorer),
        ListModelsTool(self.config_manager, self.explorer),
        GetModelSchemaTool(self.config_manager, self.explorer),
    ]
    
    for tool in tools:
        self._tools[tool.name] = tool
        logger.debug(f"Registered tool: {tool.name}")
  • MCP tool handler that validates arguments, calls the explorer service, formats the response, and handles errors.
    async def handle_call(self, arguments: Dict[str, Any]) -> List[TextContent]:
        try:
            self._validate_api_identifier(arguments["api"])
            schema = await self.explorer.get_model_schema(
                arguments["api"], arguments["model_name"]
            )
            result = self.explorer.format_model_schema(schema)
            return self._create_text_response(result)
        except Exception as e:
            return self._create_error_response(e)
  • Helper function to format the model schema data into a readable text response.
    def format_model_schema(self, schema_data: Dict[str, Any]) -> str:
        """Format model schema for display."""
        result = f"Model: {schema_data['name']}\n\n"
        result += f"Schema:\n{json.dumps(schema_data['schema'], indent=2)}"
        return result
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. While 'Get' implies a read operation, the description doesn't specify whether this requires authentication, has rate limits, returns structured data, or has any side effects. For a tool with zero annotation coverage, this is inadequate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose with zero wasted words. It's appropriately sized and front-loaded, making it easy for an agent to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is incomplete. It doesn't explain what 'detailed schema' means in terms of return format, whether it includes field types, validation rules, or example values. For a schema retrieval tool with no structured output documentation, the description should provide more context about what information is returned.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with both parameters clearly documented in the schema itself. The description adds no additional parameter information beyond what's already in the schema, so it meets the baseline score for high schema coverage without adding value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get detailed schema') and resource ('for a specific model'), providing a specific verb+resource combination. However, it doesn't explicitly distinguish this tool from its siblings like 'get_api_info' or 'get_endpoint_details' which might also provide schema-related information, so it doesn't reach the highest score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With siblings like 'list_models', 'get_api_info', and 'get_endpoint_details', there's no indication of when this specific schema retrieval is appropriate versus other information-gathering tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/nyudenkov/openapi-mcp-proxy'

If you have feedback or need assistance with the MCP directory API, please join our Discord server