mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-14 12:44:36 +00:00
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:
@@ -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",
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user