LearnNewsExamplesServices
Frontmatter
id7888
titleStandardize MCP Tool Method Signatures with Default Objects
stateClosed
labels
enhancementairefactoring
assigneestobiu
createdAtNov 24, 2025, 9:28 AM
updatedAtNov 24, 2025, 9:49 AM
githubUrlhttps://github.com/neomjs/neo/issues/7888
authortobiu
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtNov 24, 2025, 9:49 AM

Standardize MCP Tool Method Signatures with Default Objects

Closed v11.10.0 enhancementairefactoring
tobiu
tobiu commented on Nov 24, 2025, 9:28 AM

Refactor all MCP server service methods mapped to tools to ensure consistent and robust handling of optional object arguments.

Objective: Establish a strict standard for method signatures based on argument requirements:

  1. Required Arguments:

    • Pattern: async method({arg1})
    • Behavior: Do NOT provide a default object value. This ensures the call fails fast with a clear error if the required argument object is missing.
  2. Optional Arguments:

    • Pattern: async method({opt1} = {})
    • Behavior: MUST provide a default empty object. This allows the tool to be called without passing any arguments (e.g., list_summaries()) without throwing a destructuring error.

Scope:

  • ai/mcp/server/memory-core
  • ai/mcp/server/knowledge-base
  • ai/mcp/server/github-workflow

Tasks:

  1. Audit all service methods mapped in toolService.mjs for each server.
  2. Identify methods where all arguments are optional or where the method signature implies it can be called without arguments.
  3. Update the method signatures to include = {} where appropriate.
  4. Ensure methods with required arguments do not have = {}.

Specific Candidates Identified (Non-exhaustive):

  • SummaryService.listSummaries (Memory Core) - limit and offset have defaults.
  • SessionService.summarizeSessions (Memory Core) - includeAll and sessionId are optional.
  • DocumentService.listDocuments (Knowledge Base) - limit and offset likely have defaults.
  • PullRequestService.listPullRequests (GitHub) - limit and state likely have defaults.
  • IssueService.listIssues (GitHub) - arguments likely optional.
  • LabelService.listLabels (GitHub) - likely takes no args or optional args.
  • SyncService.runFullSync (GitHub) - likely no args.
  • HealthService.healthcheck (All) - likely no args.
  • DatabaseService.exportDatabase (Memory Core) - include has default.
  • RepositoryService.getViewerPermission (GitHub) - likely no args.

Note: This refactoring ensures that calling a tool like list_summaries via MCP without passing an empty object {} (which some clients might do) will not cause a server-side error.

tobiu added the enhancement label on Nov 24, 2025, 9:28 AM
tobiu added the ai label on Nov 24, 2025, 9:28 AM
tobiu added the refactoring label on Nov 24, 2025, 9:28 AM
tobiu assigned to @tobiu on Nov 24, 2025, 9:48 AM
tobiu referenced in commit a370f39 - "Standardize MCP Tool Method Signatures with Default Objects #7888" on Nov 24, 2025, 9:49 AM
tobiu closed this issue on Nov 24, 2025, 9:49 AM