actual-mcp
Version:
Actual Budget MCP server exposing API functionality
52 lines • 1.88 kB
TypeScript
import { CallToolResult, TextContent } from '@modelcontextprotocol/sdk/types.js';
/**
* Standard MCP content item types (derived from CallToolResult to stay in sync with SDK)
*/
export type ContentItem = CallToolResult['content'][number];
/**
* Text content item (most common type)
*/
export type TextContentItem = TextContent;
/**
* Standard MCP response structure (compatible with CallToolResult)
*/
export type Response = CallToolResult;
/**
* Create a successful plain text response
* @param text - The text message
* @returns A success response object with text content
*/
export declare function success(text: string): CallToolResult;
/**
* Create a success response with structured content
* @param content - Array of content items
* @returns A success response object with provided content
*/
export declare function successWithContent(content: ContentItem): CallToolResult;
/**
* Create a success response with JSON data
* @param data - Any data object that can be JSON-stringified
* @returns A success response with JSON data wrapped as a resource
*/
export declare function successWithJson<T>(data: T): CallToolResult;
/**
* Create an error response
* @param message - The error message
* @returns An error response object
*/
export declare function error(message: string): CallToolResult;
/**
* Create an error response from an Error object or any thrown value
* @param err - The error object or value
* @returns An error response object
*/
export declare function errorFromCatch(err: unknown): CallToolResult;
/**
* Extract text from a content item, narrowing the union type.
* Throws if the item is not a text content item.
*
* @param item - A content item from a CallToolResult
* @returns The text string from the content item
*/
export declare function textContent(item: ContentItem): string;
//# sourceMappingURL=response.d.ts.map