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>
Inputs¤
| Parameter | Required | Description |
|---|---|---|
brief |
No | Return tool names only. |
service |
No | Filter tools by NorFab service name. |
name |
No | Filter tools by glob pattern. |
workers |
No | FastMCP workers to target. Defaults to any worker. |
Output¤
The task returns MCP tool definitions. With brief=True, it returns tool names only.
Examples¤
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
Context manager - list Nornir tool names:
import pprint
from norfab.core.nfapi import NorFab
with NorFab(inventory="inventory.yaml") as nf:
client = nf.make_client()
result = client.run_job(
service="fastmcp",
task="get_tools",
kwargs={"brief": True, "service": "nornir"},
workers="any",
)
pprint.pprint(result)
Direct lifecycle - filter tools by name:
import pprint
from norfab.core.nfapi import NorFab
nf = NorFab(inventory="inventory.yaml")
try:
nf.start()
client = nf.make_client()
result = client.run_job(
service="fastmcp",
task="get_tools",
kwargs={"brief": True, "name": "*cli"},
workers="any",
)
pprint.pprint(result)
finally:
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\fastmcp_worker.py
539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 | |