Connect Pydantic Logfire to Claude Code

Query traces, logs, exceptions and metrics in a Pydantic Logfire project with SQL. Add Toolspoke to Claude Code once and it can use 7 Pydantic Logfire actions. Your Pydantic Logfire credential stays in Toolspoke, and you choose which actions Claude Code may call.

Set it up in Claude Code

Three steps, the first one once for every toolkit you will ever add.

  1. Add Toolspoke to Claude Code

    Run it in your project, then /mcp to sign in

    claude mcp add --transport http toolspoke https://toolspoke.com/mcp

    The sign-in opens in your browser, and Toolspoke asks you to approve it.

  2. Install Pydantic Logfire and connect it

    Add Pydantic Logfire to a project in your Toolspoke workspace.

    Read token. You provide it once, when you install the connector. Toolspoke encrypts it at rest and decrypts it only for the length of a single call, and the gateway attaches it to the outbound request itself, so it is never part of the arguments an agent sends.

    Read token
    Logfire → your project → Settings → Read tokens → Create read token. Copy it at once; it is shown only once. A read token reaches one project.
  3. Choose what Claude Code may do

    All 7 actions only read, and any of them can be switched off for a project.

What you can ask Claude Code for

A few of the Pydantic Logfire actions that only read, so they are safe to try first.

  • Show which organization and project this read token reads, its plan and its expiry
  • The slowest spans in the window, longest first, with service, span name, duration in seconds and trace id
  • List the metric names recorded in the window and how many data points each has

What Claude Code can do in Pydantic Logfire

7 actions read.

Reads

  • Get token info

    Show which organization and project this read token reads, its plan and its expiry. Takes no arguments and runs no query, so it uses none of the daily query budget.

  • Query sql

    Run a SQL query (Apache DataFusion dialect, Postgres-like) over the records table (spans and logs: start_timestamp, duration, trace_id, span_id, parent_span_id, span_name, message, level, service_name, is_exception, exception_type, exception_message, attributes) or the metrics table. Always add a LIMIT. The time window defaults to the last 24 hours; widen it with min_timestamp, up to 14 days. Results include log messages and attributes, which can hold your users' data.

  • List services

    List the services that sent data in the window, with how many records and how many exceptions each one produced. Start here to see what is instrumented.

  • List recent exceptions

    The most recent exceptions, newest first, with service, span, exception type and message, and the trace id to pass to query_sql for the full trace.

  • Exception counts

    Count exceptions by service and exception type in the window, most frequent first, with when each was last seen. The quickest answer to "what is breaking".

  • Slowest spans

    The slowest spans in the window, longest first, with service, span name, duration in seconds and trace id.

  • List metrics

    List the metric names recorded in the window and how many data points each has. Use the names in query_sql against the metrics table.

Pydantic Logfire in Claude Code: questions

Does Claude Code see my Pydantic Logfire credential?

No. The credential is stored encrypted in Toolspoke, and the gateway adds it to each call. Claude Code only ever talks to Toolspoke, and the dashboard shows the last four characters of the credential and nothing more.

Will 7 actions crowd Claude Code's context?

No. Toolspoke shows Claude Code five bridge tools, plus a guide where a toolkit has one, and Claude Code searches for the Pydantic Logfire action it needs when it needs it. Adding more toolkits does not add more tools to its list.

Can I add it once for every project?

Yes. Add --scope user to the command and Claude Code keeps Toolspoke in every project on this machine. Without it, the server is added to the project you ran the command in.

What does it cost?

Tool calls are free on every plan, and a Pydantic Logfire call does not run in a sandbox, so it bills nothing.

Try Pydantic Logfire in Claude Code

Free to start, and tool calls cost nothing on any plan.