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:
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.
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:
- Audit all service methods mapped in
toolService.mjs for each server.
- Identify methods where all arguments are optional or where the method signature implies it can be called without arguments.
- Update the method signatures to include
= {} where appropriate.
- 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.
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:
Required Arguments:
async method({arg1})Optional Arguments:
async method({opt1} = {})list_summaries()) without throwing a destructuring error.Scope:
ai/mcp/server/memory-coreai/mcp/server/knowledge-baseai/mcp/server/github-workflowTasks:
toolService.mjsfor each server.= {}where appropriate.= {}.Specific Candidates Identified (Non-exhaustive):
SummaryService.listSummaries(Memory Core) -limitandoffsethave defaults.SessionService.summarizeSessions(Memory Core) -includeAllandsessionIdare optional.DocumentService.listDocuments(Knowledge Base) -limitandoffsetlikely have defaults.PullRequestService.listPullRequests(GitHub) -limitandstatelikely 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) -includehas default.RepositoryService.getViewerPermission(GitHub) - likely no args.Note: This refactoring ensures that calling a tool like
list_summariesvia MCP without passing an empty object{}(which some clients might do) will not cause a server-side error.