gitea_context_get
Retrieve the current default context including owner, repository, organization, and project details for Gitea operations.
Instructions
Get current default context (owner, repo, org, project)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:489-499 (handler)Handler function for the 'gitea_context_get' tool. Retrieves the current Gitea context from the ContextManager and returns it as a formatted JSON string in the MCP response format.async (_args: any, _extra: any) => { const context = ctx.contextManager.getContext(); return { content: [ { type: 'text' as const, text: JSON.stringify(context, null, 2), }, ], }; }
- src/index.ts:483-500 (registration)Registration of the 'gitea_context_get' tool with the MCP server, including metadata (title, description) and the inline handler function.mcpServer.registerTool( 'gitea_context_get', { title: '获取当前上下文', description: 'Get current default context (owner, repo, org, project)', }, async (_args: any, _extra: any) => { const context = ctx.contextManager.getContext(); return { content: [ { type: 'text' as const, text: JSON.stringify(context, null, 2), }, ], }; } );
- src/index.ts:485-488 (schema)Tool metadata schema defining the title and description for 'gitea_context_get'. No input schema is specified as the tool takes no arguments.{ title: '获取当前上下文', description: 'Get current default context (owner, repo, org, project)', },
- src/context-manager.ts:62-64 (helper)The ContextManager.getContext() method called by the handler, which returns a shallow copy of the internally stored GiteaContext object.getContext(): GiteaContext { return { ...this.context }; }