logging-and-agent-invocation

A guide to recording SolidWorks tool activity and the messages exchanged during an interactive design session. SolidWorks is computer-aided design software, and MCP is the tool interface used to control it.

In plain words
What is it for?
Use it to enable database logging, identify tool phases and errors, and record multi-turn design conversations.
Why use it?
It helps you reconstruct what the tool did, what the user asked for, and where an error occurred. That makes design runs easier to replay and debug.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/andrewbartels1/solidworksmcp-python/logging-and-agent-invocation
Clone the repo
git clone --depth 1 https://github.com/andrewbartels1/SolidworksMCP-python
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,919 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.03919
Opus 5 $0.00000 $0.01959
Sonnet 5 $0.00000 $0.00784
Haiku 4.5 $0.00000 $0.00392

Measured 2d ago against content hash 90e2c7eb445d, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

logging-and-agent-invocation scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

docs/agents/logging-and-agent-invocation.md · 535 lines

How it starts

The opening of the file, as written. The whole thing — 535 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Logging Configuration and Agent Invocation Guide

This guide explains how to enable, configure, and use the logging infrastructure for SolidWorks MCP tool execution and multi-turn conversational design workflows.

Overview

The logging system has two layers:

Layer Purpose Capture Source Scope
MCP Tool Telemetry Log every SolidWorks tool call, phase transition, and error MCP server wrapper Tool lifecycle: pre → execution → post / error
Conversation Events Log chat messages, system events, and decision points Host/editor or external caller Full message flow between human and LLM

For reproducible CAD work, you need both layers. The tool telemetry ensures you can replay and debug every SolidWorks action. The conversation events let you reconstruct why a particular tool was chosen and what context the human provided.


Quick Start: Enable Logging in 60 Seconds

Step 1 — Set Environment Variables

$env:SOLIDWORKS_MCP_ENABLE_DB_LOGGING = "true"
$env:SOLIDWORKS_MCP_CONVERSATION_ID = "my-design-session-001"
$env:SOLIDWORKS_MCP_RUN_ID_PREFIX = "bracket-rebuild"

Step 2 — Start the Server

.\dev-commands.ps1 dev-run

The server uses the variables above for every tool call.

Step 3 — Use the Agent

Work with Claude Code or VS Code Copilot as normal. Every tool call is logged.

Step 4 — Query What Happened

from src.solidworks_mcp.agents import find_run_timeline, find_conversation_events

# See all events in one run
timeline = find_run_timeline("bracket-rebuild-001")
print(timeline)

# See all conversation events linked to that session
events = find_conversation_events("my-design-session-001")
for event in events:
    print(f"[{event['created_at']}] {event['role']}: {event['content_snippet']}")

Environment Variables Reference

Logging Control

Variable Values Effect Default
SOLIDWORKS_MCP_ENABLE_DB_LOGGING "true" / "false" Enable/disable all DB logging "false"
SOLIDWORKS_MCP_CONVERSATION_ID any string Conversation context ID (e.g., "baseball-bat-rebuild") auto-generated
SOLIDWORKS_MCP_RUN_ID_PREFIX any string Prefix for per-tool-batch run IDs (e.g., "sketch-pass-1") "run"
SOLIDWORKS_MCP_DB_PATH file path Override default DB location .solidworks_mcp/agent_memory.sqlite3

Read the full file on GitHub · 535 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 535 lines · 0 tokens per session scan A 90e2c7eb445d

Subscribe to this mod's changes

logging-and-agent-invocation is an agent published in the GitHub repository andrewbartels1/SolidworksMCP-python (65 stars, last pushed 6d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 3,919 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.