Skip to main content
Glama
mckinsey

vizro-mcp

Official
by mckinsey

get_model_json_schema

Retrieve JSON schema for Vizro models like Card, Dashboard, or Page to validate structure and ensure proper configuration.

Instructions

Get the JSON schema for the specified Vizro model. Server Vizro version: 0.1.50

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
model_nameYesName of the Vizro model to get schema for (e.g., 'Card', 'Dashboard', 'Page')

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
model_nameYes
json_schemaYes
additional_infoYes

Implementation Reference

  • The core handler function for the 'get_model_json_schema' tool, decorated with @mcp.tool() for registration. It retrieves the JSON schema for a given Vizro model name, handling special cases for modified, deprecated, and layout models.
    @mcp.tool(description=f"Get the JSON schema for the specified Vizro model. Server Vizro version: {vizro.__version__}")
    def get_model_json_schema(
        model_name: str = Field(
            description="Name of the Vizro model to get schema for (e.g., 'Card', 'Dashboard', 'Page')"
        ),
    ) -> ModelJsonSchemaResults:
        """Get the JSON schema for the specified Vizro model.
    
        Returns:
            JSON schema of the requested Vizro model
        """
        if not hasattr(vm, model_name):
            return ModelJsonSchemaResults(
                model_name=model_name,
                json_schema={},
                additional_info=f"Model '{model_name}' not found in vizro.models",
            )
    
        modified_models = {
            "Graph": GraphEnhanced,
            "AgGrid": AgGridEnhanced,
            "Table": AgGridEnhanced,
            "Figure": FigureEnhanced,
        }
    
        if model_name in modified_models:
            return ModelJsonSchemaResults(
                model_name=model_name,
                json_schema=modified_models[model_name].model_json_schema(schema_generator=NoDefsGenerateJsonSchema),
                additional_info="""LLM must remember to replace `$ref` with the actual config. Request the schema of
    that model if necessary. Do NOT forget to call `validate_dashboard_config` after each iteration.""",
            )
        deprecated_models = {"filter_interaction": "set_control", "Layout": "Grid"}
        if model_name in deprecated_models:
            return ModelJsonSchemaResults(
                model_name=model_name,
                json_schema={},
                additional_info=f"Model '{model_name}' is deprecated. Use {deprecated_models[model_name]} instead.",
            )
    
        model_class = getattr(vm, model_name)
        if model_name in {"Grid", "Flex"}:
            return ModelJsonSchemaResults(
                model_name=model_name,
                json_schema=model_class.model_json_schema(schema_generator=NoDefsGenerateJsonSchema),
                additional_info=LAYOUT_INSTRUCTIONS,
            )
    
        return ModelJsonSchemaResults(
            model_name=model_name,
            json_schema=model_class.model_json_schema(schema_generator=NoDefsGenerateJsonSchema),
            additional_info="""LLM must remember to replace `$ref` with the actual config. Request the schema of
    that model if necessary. Do NOT forget to call `validate_dashboard_config` after each iteration.""",
        )
  • Dataclass defining the structured output for the get_model_json_schema tool, including model name, JSON schema, and additional info.
    @dataclass
    class ModelJsonSchemaResults:
        """Results of the get_model_json_schema tool."""
    
        model_name: str
        json_schema: dict[str, Any]
        additional_info: str
  • The @mcp.tool decorator registers the get_model_json_schema function as an MCP tool.
    @mcp.tool(description=f"Get the JSON schema for the specified Vizro model. Server Vizro version: {vizro.__version__}")
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('Get') but doesn't describe traits like whether it's read-only, requires authentication, has rate limits, or what the output entails (though an output schema exists). The server version note adds minor context but doesn't cover key behavioral aspects for a tool that likely fetches structured data.

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

Conciseness4/5

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

The description is a single, efficient sentence that front-loads the core purpose. The server version note is arguably extraneous but not overly verbose. It avoids redundancy and wastes no words, though it could be slightly more structured for clarity.

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

Completeness4/5

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

Given the tool's simplicity (1 parameter, 100% schema coverage, output schema exists), the description is reasonably complete. It specifies the resource (Vizro model JSON schema) and server context. The output schema handles return values, so the description doesn't need to explain those. However, it lacks behavioral context, which is a minor gap in completeness.

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 the parameter 'model_name' well-documented in the schema itself (e.g., examples like 'Card', 'Dashboard', 'Page'). The description adds no additional parameter semantics beyond what the schema provides, so it meets the baseline score of 3 for high schema coverage without compensating 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 verb 'Get' and the resource 'JSON schema for the specified Vizro model', making the purpose specific and understandable. It distinguishes from siblings by focusing on schema retrieval rather than data analysis, validation, or planning. However, it doesn't explicitly differentiate from all siblings (e.g., 'validate_dashboard_config' might also involve schemas), keeping it from a perfect 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. It mentions the server version, which is contextual but not usage-related. There's no indication of prerequisites, when-not-to-use scenarios, or comparisons to sibling tools like 'validate_dart_code' or 'get_sample_data_info' that might overlap in model-related tasks.

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/mckinsey/vizro'

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