Implementation:1mcp app Agent inspectCommand
| Knowledge Sources | |
|---|---|
| Domains | CLI, MCP_Protocol |
| Last Updated | 2026-10-29 00:00 GMT |
Overview
Concrete CLI command for inspecting MCP servers and individual tool schemas with pagination, search, and multiple output formats.
Description
The inspectCommand function inspects a server or a specific tool within a server. It connects to the running runtime, queries the server's capabilities and tool list, and prints formatted output. It supports inspecting a single server (`inspect <server>`), a specific tool (`inspect <server>/<tool>`), or all servers. Features include pagination (limit, cursor), search, glob matching, and multiple output formats (table, json, list). The companion `getInspectResult` function returns structured data for programmatic use.
Usage
Import this function when you need to:
- Inspect all tools available from a specific MCP server
- Get the JSON schema for a specific tool before invoking it
- Search across all tools with glob or text search
- Paginate through large tool lists
Code Reference
Source Location
- Repository: 1MCP Agent
- File: src/commands/inspect/inspect.ts (L177-464)
Signature
export interface InspectCommandOptions extends GlobalOptions, ProjectSelectionOptions {
target: string;
url?: string;
context?: string;
preset?: string;
filter?: string;
format?: InspectOutputFormat;
all?: boolean;
limit?: number;
cursor?: string;
search?: string;
glob?: boolean;
}
export async function inspectCommand(options: InspectCommandOptions): Promise<void>;
export async function getInspectResult(
options: InspectCommandOptions,
opts?: GetInspectResultOptions,
): Promise<InspectResult>;
Import
import { inspectCommand, getInspectResult } from '@src/commands/inspect/inspect.js';
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| target | string | Yes | Server or server/tool reference |
| format | InspectOutputFormat | No | Output format |
| limit | number | No | Pagination limit |
| cursor | string | No | Pagination cursor |
| search | string | No | Search query |
| glob | boolean | No | Glob pattern matching |
Outputs
| Name | Type | Description |
|---|---|---|
| stdout | formatted text | Server info, tool list, or tool schema |
| getInspectResult | InspectResult | Structured result for programmatic use |
Usage Examples
Inspect Server and Tool
1mcp inspect my-server
1mcp inspect my-server/my-tool
1mcp inspect --all --format=json
1mcp inspect my-server --search "read" --glob
1mcp inspect my-server --limit=10 --cursor=next