Skip to main content
Glama
pydantic

Logfire MCP Server

Official

logfire_link

Generates a link using a trace ID to open the trace details in the Logfire UI, enabling quick access to trace analysis.

Instructions

Creates a link to help the user to view the trace in the Logfire UI.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
trace_idYesThe trace ID to link to.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function for the 'logfire_link' tool. It fetches the read token info to get organization/project names, constructs a Logfire UI URL with the trace_id query parameter, and returns it as a string.
    async def logfire_link(
        ctx: Context[ServerSession, MCPState],
        trace_id: Annotated[str, Field(description='The trace ID to link to.')],
    ) -> str:
        """Creates a link to help the user to view the trace in the Logfire UI."""
        logfire_client = ctx.request_context.lifespan_context.logfire_client
        response = await logfire_client.client.get('/v1/read-token-info')
        read_token_info = cast(ReadTokenInfo, response.json())
        organization_name = read_token_info['organization_name']
        project_name = read_token_info['project_name']
    
        url = logfire_client.client.base_url
        url = url.join(f'{organization_name}/{project_name}')
        url = url.copy_add_param('q', f"trace_id='{trace_id}'")
        return str(url)
  • TypedDict schema for the read token info returned by the API, used by logfire_link to extract organization_name and project_name.
    class ReadTokenInfo(TypedDict):
        token_id: str
        organization_id: str
        project_id: str
        organization_name: str
        project_name: str
  • Registration of the logfire_link function as an MCP tool via the FastMCP.tool() decorator.
    mcp.tool()(logfire_link)
Behavior3/5

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

No annotations provided, so description carries full burden. It indicates a non-destructive action, but does not disclose return format, side effects, or permissions. Minimal disclosure beyond the action.

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?

Single sentence, front-loaded purpose, zero unnecessary words. Efficient for an agent to parse.

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 single parameter and output schema (not shown but indicated as present), description covers basic usage. Could mention return value format (e.g., URL) but not critical since output schema likely covers it.

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?

Schema coverage is 100% with the parameter 'trace_id' already described. The description 'trace ID to link to' adds no new information beyond the schema, meeting the baseline for high coverage.

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

Purpose5/5

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

Description clearly states verb (creates), resource (link), and purpose (view trace in Logfire UI). Distinguishes from sibling tools like arbitrary_query and find_exceptions_in_file.

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

Usage Guidelines3/5

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

Description implies usage context (when you have a trace_id and want a UI link), but no explicit when-to-use or when-not-to-use guidance. No mention of alternatives.

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/pydantic/logfire-mcp'

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