Skip to content

Class: Tool

A function-call tool usable by an LM (dspy.Tool).

URI: dspy:Tool

 classDiagram
    class Tool
    click Tool href "../Tool/"
      NamedThing <|-- Tool
        click NamedThing href "../NamedThing/"

      Tool : arg_desc





        Tool --> "0..1" Any : arg_desc
        click Any href "../Any/"



      Tool : arg_types





        Tool --> "0..1" Any : arg_types
        click Any href "../Any/"



      Tool : args





        Tool --> "0..1" Any : args
        click Any href "../Any/"



      Tool : desc

      Tool : description

      Tool : func

      Tool : has_kwargs

      Tool : id

      Tool : name

Inheritance

Class Properties

Property Value
Class URI dspy:Tool

Slots

Name Cardinality and Range Description Inheritance
func 0..1
String
Dotted import path of the Python callable wrapped by a Tool direct
desc 0..1
String
Field description as passed to ``InputField(desc= direct
args 0..1
Any
JSON-schema dict describing tool argument shapes direct
arg_types 0..1
Any
Dict from arg name to Python type name direct
arg_desc 0..1
Any
Dict from arg name to argument description direct
has_kwargs 0..1
Boolean
Whether the tool accepts arbitrary **kwargs direct
id 1
Identifier
Stable opaque identifier for an instance NamedThing
name 0..1
String
Short human-readable name NamedThing
description 0..1
String
Free-form description NamedThing

Usages

used by used in type used
ReAct tools range Tool
ReActV2 tools range Tool
CodeAct tools range Tool

In Subsets

Identifier and Mapping Information

Annotations

property value
dspy_source_paths ['dspy/adapters/types/tool.py']
dspy_source_urls ['https://github.com/stanfordnlp/dspy/blob/main/dspy/adapters/types/tool.py']

Schema Source

Mappings

Mapping Type Mapped Value
self dspy:Tool
native dspy:Tool
exact mcp:Tool
related nexus:Capability, uco_action:Action, uco_core:UcoObject
close mellea:MethodSpec, uco_tool:Tool

LinkML Source

Direct

name: Tool
annotations:
  dspy_source_paths:
    tag: dspy_source_paths
    value:
    - dspy/adapters/types/tool.py
  dspy_source_urls:
    tag: dspy_source_urls
    value:
    - https://github.com/stanfordnlp/dspy/blob/main/dspy/adapters/types/tool.py
description: A function-call tool usable by an LM (``dspy.Tool``).
in_subset:
- tooling
- custom_types
from_schema: https://w3id.org/lmodel/dspy
exact_mappings:
- mcp:Tool
close_mappings:
- mellea:MethodSpec
- uco_tool:Tool
related_mappings:
- nexus:Capability
- uco_action:Action
- uco_core:UcoObject
is_a: NamedThing
slots:
- func
- desc
- args
- arg_types
- arg_desc
- has_kwargs
class_uri: dspy:Tool

Induced

name: Tool
annotations:
  dspy_source_paths:
    tag: dspy_source_paths
    value:
    - dspy/adapters/types/tool.py
  dspy_source_urls:
    tag: dspy_source_urls
    value:
    - https://github.com/stanfordnlp/dspy/blob/main/dspy/adapters/types/tool.py
description: A function-call tool usable by an LM (``dspy.Tool``).
in_subset:
- tooling
- custom_types
from_schema: https://w3id.org/lmodel/dspy
exact_mappings:
- mcp:Tool
close_mappings:
- mellea:MethodSpec
- uco_tool:Tool
related_mappings:
- nexus:Capability
- uco_action:Action
- uco_core:UcoObject
is_a: NamedThing
attributes:
  func:
    name: func
    description: Dotted import path of the Python callable wrapped by a Tool.
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    owner: Tool
    domain_of:
    - Tool
    range: string
  desc:
    name: desc
    description: Field description as passed to ``InputField(desc=...)`` / ``OutputField(desc=...)``.
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    owner: Tool
    domain_of:
    - SignatureField
    - Tool
    range: string
  args:
    name: args
    description: JSON-schema dict describing tool argument shapes.
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    owner: Tool
    domain_of:
    - Tool
    - ToolCall
    - LMToolCallPart
    range: Any
  arg_types:
    name: arg_types
    description: Dict from arg name to Python type name.
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    owner: Tool
    domain_of:
    - Tool
    range: Any
  arg_desc:
    name: arg_desc
    description: Dict from arg name to argument description.
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    owner: Tool
    domain_of:
    - Tool
    range: Any
  has_kwargs:
    name: has_kwargs
    description: Whether the tool accepts arbitrary ``**kwargs``.
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    ifabsent: boolean(False)
    owner: Tool
    domain_of:
    - Tool
    range: boolean
  id:
    name: id
    description: Stable opaque identifier for an instance.
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    slot_uri: schema:identifier
    identifier: true
    owner: Tool
    domain_of:
    - NamedThing
    range: Identifier
    required: true
  name:
    name: name
    description: Short human-readable name.
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    slot_uri: rdfs:label
    owner: Tool
    domain_of:
    - NamedThing
    - LMToolCallPart
    - LMMessage
    - LMToolSpec
    range: string
  description:
    name: description
    description: Free-form description.
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    slot_uri: dct:description
    owner: Tool
    domain_of:
    - NamedThing
    - LMToolSpec
    range: string
class_uri: dspy:Tool