Python API Docs

This section is for users importing tigl-mcp as a Python package. It focuses on the importable module surface and callable entrypoints.

Top-level package

Model Context Protocol server for TiGL/CPACS geometry.

exception tigl_mcp.MCPError(error_type, message, details=None)[source]

Structured MCP error containing a JSON-friendly payload.

Create a structured MCP error payload.

to_dict()[source]

Return the structured error payload.

class tigl_mcp.SessionManager[source]

In-memory manager mapping session identifiers to handles.

Initialize the session manager with empty state.

close(session_id)[source]

Close and remove a session.

create_session(tixi_handle, tigl_handle, config, cpacs_xml)[source]

Register a new session and return its identifier.

get(session_id)[source]

Retrieve handles for a session or raise an MCP error.

get_cpacs_xml(session_id)[source]

Retrieve the original CPACS XML for a session.

class tigl_mcp.ToolDefinition(name, description, parameters_model, handler, output_schema=None)[source]

Description of a tool that can be registered with the server.

name

Unique name of the tool.

Type:

str

description

Human-readable description of the tool purpose.

Type:

str

parameters_model

Pydantic model used to validate input parameters.

Type:

type[tigl_mcp.tooling.ToolParameters]

handler

Callable that executes the tool logic.

Type:

collections.abc.Callable[[dict[str, Any]], dict[str, Any]]

metadata()[source]

Return a discovery-friendly description of the tool.

validate(parameters)[source]

Validate and coerce incoming tool parameters.

Parameters:

parameters – Input parameters provided for the tool.

Raises:

ValueError – If parameter validation fails.

Returns:

Validated parameter dictionary.

class tigl_mcp.ToolParameters[source]

Base parameters schema for MCP tools.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

model_config = {'extra': 'forbid'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

CLI entrypoint

Entry point for the TiGL MCP FastMCP server.

tigl_mcp.main.build_parser()[source]

Create the argument parser for the FastMCP server CLI.

tigl_mcp.main.main(argv=None)[source]

Register tools and start the FastMCP server.