Skip to content

Enhance MCP server with resource handling and documentation improvements #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Dec 19, 2024

Conversation

delano
Copy link
Owner

@delano delano commented Dec 19, 2024

Implement MCP-compliant prompts and refactor resource handling with improved templating and rate limiting. Expand Postman API support and enhance error handling in the MCP server. Update documentation to reflect the new systematic approach for building Postman API functionality.

…iting

Add base resource handler interface and implement Postman-specific handler with support for templated resources and rate limiting. Includes new types for resources, templates, and content management.
Enhances MCP server with improved error handling and resource management

Add robust error handling, graceful shutdown, and tool resource
management capabilities. Includes axios interceptors for better API
error handling, structured shutdown process, and implementation of the
ToolResourceHandler interface for resource validation.
Documents the systematic approach for building Postman API functionality:
- Splitting OpenAPI specs into individual YAML files
- Creating markdown summaries
- Implementing and verifying MCP server tools
- Cross-checking against documentation

Emphasizes iterative nature of process and its applicability for future API changes
@delano delano requested a review from Copilot December 19, 2024 04:41
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • docs/api/summaries/README.md: Evaluated as low risk
Comments suppressed due to low confidence (10)

src/tools/api/base.ts:153

  • [nitpick] The error message should be more specific, indicating that the resource is not supported by the tool. Consider changing it to: Resource ${resourceUri} is not supported by this tool.
throw new McpError(ErrorCode.InvalidRequest, `Resource ${resourceUri} cannot be handled by this tool`);

src/tools/api/base.ts:141

  • The listToolResources method introduces new behavior that should be covered by tests. Ensure there are tests validating the functionality of this method.
public async listToolResources(): Promise<ToolResource[]> {

src/server.ts:20

  • [nitpick] The class name 'McpResourceHandler' is inconsistent with the naming conventions used elsewhere. Consider renaming it to 'ResourceHandler' for consistency.
import { McpResourceHandler,

src/server.ts:90

  • The error message 'Postman API error' could be more specific. Consider including more context about the error, such as the endpoint that failed.
throw new McpError(

src/types/tool.ts:40

  • The method listToolResources should have error handling to throw an appropriate error if resources cannot be listed.
listToolResources(): Promise<ToolResource[]>;

src/types/tool.ts:47

  • The method getToolResourceDetails should have error handling to throw an appropriate error if the resource cannot be found or accessed.
getToolResourceDetails(resourceUri: string): Promise<ToolResource>;

src/types/tool.ts:35

  • [nitpick] Consider renaming ToolResourceHandler to ToolResourceManager to better reflect its purpose.
export interface ToolResourceHandler {

src/types/tool.ts:29

  • [nitpick] Define a specific type for operations to avoid ambiguity and improve readability.
operations: string[];

src/handlers/tool-handler.ts:53

  • The method listToolResources is called without checking if the handler implements it. Add a check to ensure the handler has this method.
const resources = await handler.listToolResources();

src/handlers/tool-handler.ts:78

  • Ensure canHandleResource returns a boolean and handles any potential exceptions.
return handler.canHandleResource(resourceUri);

@delano delano merged commit fb83f6e into main Dec 19, 2024
@delano delano deleted the delano/2024-12-18-improve-mcp branch December 19, 2024 05:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant