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
This commit is contained in:
Gab
2026-04-12 16:56:45 +10:00
parent aeab50796a
commit 5dac031628
2 changed files with 14 additions and 2 deletions

View File

@@ -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",

View File

@@ -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<string, unknown>
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,