FastMCP Service Get Tools Task¤
task api name:
get_tools
FastMCP service get_tools task returns the list of MCP tools generated by FastMCP worker.
Tools are created from NorFab service tasks and follow this naming convention:
service_<service_name>__task_<task_name>
FastMCP Get Tools Sample Usage¤
Example
List all tools:
nf#show fastmcp tools
List tools for a specific service (names only):
nf#show fastmcp tools service nornir brief
Filter tools by name using glob patterns:
nf#show fastmcp tools name "*cli" brief
import pprint
from norfab.core.nfapi import NorFab
if __name__ == "__main__":
nf = NorFab(inventory="inventory.yaml")
nf.start()
nfclient = nf.make_client()
result = nfclient.run_job(
"fastmcp",
"get_tools",
kwargs={"brief": True, "service": "nornir"},
workers="any",
)
pprint.pprint(result)
nf.destroy()
NORFAB FastMCP Get Tools Command Shell Reference¤
NorFab shell supports these command options for FastMCP get_tools task:
nf#man tree show.fastmcp.tools
root
└── show: NorFab show commands
└── fastmcp: Show FastMCP service
└── tools: show FastMCP server tools
├── brief: show tools names only
├── service: filter tools by service name
├── name: filter tools by name using glob pattern
├── workers: Filter worker to target, default 'any'
└── timeout: Job timeout
nf#
Python API Reference¤
Retrieve tools from the available norfab services, optionally filtered by service name and tool name pattern.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
brief
|
bool
|
If True, returns a list of tool names. If False, returns a dictionary with tool details. |
False
|
service
|
str
|
The name of the service to filter tools by. Use "all" to include all services. |
'all'
|
name
|
str
|
A glob pattern to match tool names. |
'*'
|
Returns:
| Name | Type | Description |
|---|---|---|
Result |
Result
|
An object containing the filtered tools. If brief is True, result is a list of tool names. Otherwise, result is a dictionary mapping tool names to their details. |
Source code in norfab\workers\fastmcp_worker.py
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | |