Skip to content
2 min read · 313 words

Interface: ToolMethodDescriptor

Metadata table entry for one of the artifact's existing query methods, used by SpooledArtifact.forgeTools to surface that method as an @nhtio/adk!ArtifactTool.

Remarks

This is a metadata shape, not a general method → tool pipeline. forgeTools knows how to marshal arguments for a fixed, closed set of method names (the base seven on SpooledArtifact and the JSON/Markdown methods on the bundled subclasses); a descriptor is the place to attach a tool name, description, args schema, and optional serializer to one of those methods. Adding a descriptor for a method whose name is not in that closed set will produce a tool whose handler invokes the method with no arguments.

For new methods that require custom argument marshalling, branching, multi-step logic, cross-artifact joins, or any other behaviour beyond "call this existing method," override SpooledArtifact.forgeTools and mint the @nhtio/adk!ArtifactTool directly — do not try to express it through a descriptor.

Zero-arg methods are the exception: a descriptor with no argsSchema (or one that adds only callId-adjacent fields you don't consume) works for any method that takes no arguments, regardless of name.

Properties

PropertyTypeDescription
argsSchema?ObjectSchema<any>Schema for the method's own args, NOT including callId. forgeTools() injects callId.
descriptionstringHuman-readable description passed to the model. Should mention "in this turn" so the model understands the artifact's lifecycle scope.
methodstringMethod to invoke on the resolved artifact instance (e.g. 'head', 'json_get').
namestringAbsolute tool name as exposed to the LLM (e.g. 'artifact_head').
serialise?(result: unknown) => stringOptional formatter for non-string return values. Defaults: string → as-is; string[] → newline-join; number → String(n); otherwise JSON.stringify(value, null, 2).