Programmatic Tool Call

Exposes programmable tool calls for Claude Code via MCP to execute batched tool invocations in a single run.
  • python

0

GitHub Stars

python

Language

4 months ago

First Indexed

2 months ago

Catalog Refreshed

Documentation & install

Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.

Installation

Add the following to your MCP client configuration file.

Configuration

View docs

You can run Claude Code with Programmatic Tool Calling for Claude Code (PTC) via MCP. This MCP server lets you batch tool calls inside a single execution, reducing token usage and latency by avoiding repeated context window entries for each tool invocation.

How to use

Prepare your Claude Code workflow to leverage the three MCP tools exposed by this server. Use list_callable_tools to discover available tools, inspect_tool to understand a tool’s schema, and execute_program to run your Python script with integrated tool calls as async functions. Your script will run with tool calls executed behind the scenes, while only your script’s stdout is returned to you.

How to install

Prerequisites: Python 3.11+ and a running MCP environment for Tool Calling.

uv venv && uv pip install -e ".[dev]"

Configuration and usage notes

This configuration enables two MCP connections: a standard http-based MCP for a remote server and a local stdio-based MCP for a local tool bridge.

servers:
  - name: financial-data
    transport: stdio
    command: node
    args: ["./financial-data-mcp/dist/index.js"]

  - name: internal-apis
    transport: sse
    url: "http://localhost:8080/mcp"

tools:
  block:
    - "mcp__internal_apis__delete_resource"

execution:
  timeout_seconds: 120
  max_output_bytes: 65536

Example usage

Here is how you can run a script that uses the registered MCP tools inside a single program run. All tool calls happen inside the script and only stdout is returned to you.

execute_program(code="""
# Example: fetch and print data for multiple tickers in a batched run
tickers = ["AMZN", "MSFT", "GOOG"]
for t in tickers:
    data = await mcp__financial_data__query_financials(
        ticker=t, statement="income", period="quarter", limit=4
    )
    revenues = [q["revenue"] for q in data]
    trend = " → ".join(f"${r/1e9:.1f}B" for r in revenues)
    print(f"{t}: {trend}")
""")

Results and how they appear

Claude sees only the final stdout of the program, while intermediate tool results stay inside the Python runtime and never enter the conversation.

Tools exposed by the MCP server

The server provides a small set of callable tools to build batched workflows. You can discover and inspect these tools before writing your script.

Available tools

list_callable_tools

Returns a JSON array of all available tool names, enabling you to discover what can be called.

inspect_tool

Returns the schema and description of a specific tool, including its outputSchema when defined by the upstream server.

execute_program

Runs a Python script with MCP tools injected as async functions. Only stdout is returned; intermediate tool results stay in runtime.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational