{"record":{"id":"5b0aa320404b123d","repo":"googleapis/mcp-toolbox","slug":"w-q","errorCode":null,"errorMessage":"%w: %q","messagePattern":"%w: %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/tools/tools.go","lineNumber":59,"sourceCode":"// produce the specific ToolConfig type. It returns true if the registration was\n// successful, and false if a tool with the same type was already registered.\nfunc Register(resourceType string, factory ToolConfigFactory) bool {\n\tif _, exists := toolRegistry[resourceType]; exists {\n\t\t// Tool with this type already exists, do not overwrite.\n\t\treturn false\n\t}\n\ttoolRegistry[resourceType] = factory\n\treturn true\n}\n\nvar ErrUnknownToolType = fmt.Errorf(\"unknown tool type\")\n\n// DecodeConfig looks up the registered factory for the given type and uses it\n// to decode the tool configuration.\nfunc DecodeConfig(ctx context.Context, resourceType string, name string, decoder *yaml.Decoder) (ToolConfig, error) {\n\tfactory, found := toolRegistry[resourceType]\n\tif !found {\n\t\treturn nil, fmt.Errorf(\"%w: %q\", ErrUnknownToolType, resourceType)\n\t}\n\ttoolConfig, err := factory(ctx, name, decoder)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to parse tool %q as type %q: %w\", name, resourceType, err)\n\t}\n\treturn toolConfig, nil\n}\n\ntype ToolConfig interface {\n\tToolConfigType() string\n\tInitialize(context.Context) (Tool, error)\n}\n\n// https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations\ntype ToolAnnotations struct {\n\tDestructiveHint *bool `json:\"destructiveHint,omitempty\" yaml:\"destructiveHint,omitempty\"`\n\tIdempotentHint  *bool `json:\"idempotentHint,omitempty\" yaml:\"idempotentHint,omitempty\"`\n\tOpenWorldHint   *bool `json:\"openWorldHint,omitempty\" yaml:\"openWorldHint,omitempty\"`","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/tools.go#L41-L77","documentation":"DecodeConfig looks up a registered tool factory by resource type (the YAML tool kind, e.g. \"trino-execute-sql\"). If no factory is registered for that type string, the lookup fails and this error wrapping ErrUnknownToolType is returned. It means the tool `kind`/`type` in the tools configuration is not recognized by the binary.","triggerScenarios":"Calling tools.DecodeConfig (via UnmarshalYAMLToolConfig while parsing the tools YAML) with a resourceType string that has no entry in toolRegistry — typically a misspelled or unsupported `kind:` value in the YAML config.","commonSituations":"Typo in the tool kind in tools.yaml (e.g. \"trino-execut-sql\"); using a tool type from a newer toolbox version than the binary being run; building a custom binary that omits the package whose init() registers the tool; wrong casing since the lookup is exact-match.","solutions":["Check the `kind:` field in the tool's YAML block against the documented tool type names and fix the typo/casing","Upgrade the toolbox binary to a version that supports the tool type","If using a custom build, import the package containing the tool so its init() registration runs","Verify with the error's quoted value which type string is actually being looked up"],"exampleFix":"// before (tools.yaml)\nkind: trino-executesql\n// after\nkind: trino-execute-sql","handlingStrategy":"validation","validationCode":"knownTypes := []string{\"trino-execute-sql\", \"trino-sql\"} // union of supported kinds for your binary\nif !slices.Contains(knownTypes, cfg.Kind) {\n    return fmt.Errorf(\"unsupported tool kind %q; supported: %v\", cfg.Kind, knownTypes)\n}","typeGuard":null,"tryCatchPattern":"var tc tools.ToolConfig\ncfg, err := tools.DecodeConfig(ctx, resourceType, name, dec)\nif err != nil {\n    if errors.Is(err, tools.ErrUnknownToolType) {\n        // reject config early with a clear message listing valid kinds\n    }\n    return err\n}\n_ = tc","preventionTips":["Keep a tested reference tools.yaml and copy tool blocks from it","Pin the toolbox version and check the release notes before using new tool kinds","Never hand-type the kind value; copy it from the tool's documentation page","Use a schema/JSON-schema linter over tools.yaml in CI"],"tags":["go","config","yaml","tool-registry"],"backgroundTag":"unknown-tool-type","analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}