amazon-seller-mcp
Version:
Model Context Protocol (MCP) client for Amazon Selling Partner API
90 lines (89 loc) • 2.36 kB
TypeScript
/**
* Tool registration for the Amazon Seller MCP Server
*/
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import type { ZodSchema, ZodRawShape } from 'zod';
/**
* JSON Schema definition for tool input validation
*/
export interface JsonSchema {
type?: string;
properties?: Record<string, JsonSchema>;
required?: string[];
items?: JsonSchema;
enum?: unknown[];
[key: string]: unknown;
}
/**
* Tool registration options
*/
export interface ToolRegistrationOptions {
/**
* Tool title
*/
title: string;
/**
* Tool description
*/
description: string;
/**
* Input schema for the tool
*/
inputSchema: ZodSchema | ZodRawShape;
}
/**
* Tool handler function
*/
export type ToolHandler<T = unknown> = (input: T) => Promise<{
content: Array<{
type: 'text';
text: string;
} | {
type: 'resource_link';
uri: string;
name: string;
mimeType?: string;
description?: string;
}>;
isError?: boolean;
}>;
/**
* Tool registration manager
*/
export declare class ToolRegistrationManager {
private server;
private registeredTools;
private toolHandlers;
/**
* Creates a new tool registration manager
* @param server MCP server instance
*/
constructor(server: McpServer);
/**
* Registers a tool with the MCP server
*
* @param name Tool name
* @param options Tool registration options
* @param handler Tool handler function
* @returns True if the tool was registered, false if it was already registered
*/
registerTool<T = unknown>(name: string, options: ToolRegistrationOptions, handler: ToolHandler<T>): boolean;
/**
* Gets the list of registered tool names
* @returns Array of registered tool names
*/
getRegisteredTools(): string[];
/**
* Checks if a tool is registered
* @param name Tool name
* @returns True if the tool is registered, false otherwise
*/
isToolRegistered(name: string): boolean;
/**
* Gets a tool handler for direct invocation (primarily for testing)
* @param name Tool name
* @returns Tool handler function
* @throws Error if the tool is not registered
*/
getToolHandler<T = unknown>(name: string): ToolHandler<T>;
}