From 5dac03162833c4f1643ce29a1f4c9bd03f968c0b Mon Sep 17 00:00:00 2001 From: Gab Date: Sun, 12 Apr 2026 16:56:45 +1000 Subject: [PATCH] Bump to 1.0.32: mark ToothFairy tool credentials as optional in schema - Remove api_key, workspace_id, region from required parameters - Add note to tool description that credentials auto-load - Add logging for credential auto-fill debugging --- packages/tfcode/package.json | 2 +- packages/tfcode/src/mcp/index.ts | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/tfcode/package.json b/packages/tfcode/package.json index 003504241..6b5a6052f 100644 --- a/packages/tfcode/package.json +++ b/packages/tfcode/package.json @@ -1,6 +1,6 @@ { "$schema": "https://json.schemastore.org/package.json", - "version": "1.0.31", + "version": "1.0.32", "name": "@toothfairyai/tfcode", "type": "module", "license": "MIT", diff --git a/packages/tfcode/src/mcp/index.ts b/packages/tfcode/src/mcp/index.ts index 0692314cc..4770796d5 100644 --- a/packages/tfcode/src/mcp/index.ts +++ b/packages/tfcode/src/mcp/index.ts @@ -144,14 +144,26 @@ export namespace MCP { const isTFCredTool = (name: string) => name.startsWith("toothfairy_") && (schema.properties?.api_key || schema.properties?.workspace_id) + if (isTFCredTool(mcpTool.name)) { + schema.required = (schema.required || []).filter((r) => r !== "api_key" && r !== "workspace_id" && r !== "region") + } + + const description = isTFCredTool(mcpTool.name) + ? `${mcpTool.description ?? ""}\n\nNote: api_key, workspace_id, and region are optional. If not provided, they will be automatically loaded from stored credentials (run 'tfcode validate' first).` + : (mcpTool.description ?? "") + return dynamicTool({ - description: mcpTool.description ?? "", + description, inputSchema: jsonSchema(schema), execute: async (args: unknown) => { let finalArgs = (args || {}) as Record if (isTFCredTool(mcpTool.name)) { const creds = await loadTFCredentials() + log.info("auto-filling TF credentials", { + tool: mcpTool.name, + hasStoredCreds: !!(creds.api_key && creds.workspace_id), + }) finalArgs = { ...finalArgs, api_key: finalArgs.api_key || creds.api_key,