Skip to content

Commit ebacf36

Browse files
committed
update contract
1 parent 0017a66 commit ebacf36

3 files changed

Lines changed: 45 additions & 45 deletions

File tree

README.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ This tool provides a list of all available API methods from the configured sourc
255255

256256
```typescript
257257
{
258-
source?: string; // The name of the API source (e.g., "GitHub") from MCP configuration environment variables. If not provided, docs from all sources will be returned.
258+
sourceName?: string; // The name of the API source (e.g., "GitHub") from MCP configuration environment variables. If not provided, docs from all sources will be returned.
259259
}
260260
```
261261

@@ -264,11 +264,11 @@ This tool provides a list of all available API methods from the configured sourc
264264
```typescript
265265
{
266266
sources: Array<{
267-
name: string; // The name of the source API
267+
sourceName: string; // The name of the source API
268268
resources: Array<{
269-
name: string; // The name of the API resource
270-
description: string; // A brief description of the API resource
269+
resourceName: string; // The name of the API resource
271270
resourceType: string; // The type of the API resource (e.g., "POST", "GET", "mutation", "query")
271+
resourceDescription: string; // A brief description of the API resource
272272
}>;
273273
}>;
274274
}
@@ -280,32 +280,32 @@ This tool provides a list of all available API methods from the configured sourc
280280
{
281281
"sources": [
282282
{
283-
"name": "GitHubGraphQL",
283+
"sourceName": "GitHubGraphQL",
284284
"resources": [
285285
{
286-
"name": "getUser",
287-
"description": "Fetch a user by username",
288-
"resourceType": "query"
286+
"resourceName": "getUser",
287+
"resourceType": "query",
288+
"resourceDescription": "Fetch a user by username"
289289
},
290290
{
291-
"name": "createIssue",
292-
"description": "Create a new issue in a repository",
293-
"resourceType": "mutation"
291+
"resourceName": "createIssue",
292+
"resourceType": "mutation",
293+
"resourceDescription": "Create a new issue in a repository"
294294
}
295295
]
296296
},
297297
{
298-
"name": "PetstoreAPI",
298+
"sourceName": "PetstoreAPI",
299299
"resources": [
300300
{
301-
"name": "getPetById",
302-
"description": "Find pet by ID",
303-
"resourceType": "GET"
301+
"resourceName": "getPetById",
302+
"resourceType": "GET",
303+
"resourceDescription": "Find pet by ID"
304304
},
305305
{
306-
"name": "addPet",
307-
"description": "Add a new pet to the store",
308-
"resourceType": "POST"
306+
"resourceName": "addPet",
307+
"resourceType": "POST",
308+
"resourceDescription": "Add a new pet to the store"
309309
}
310310
]
311311
}
@@ -323,7 +323,7 @@ This tool provides detailed documentation for a specific API method.
323323

324324
```typescript
325325
{
326-
detailName: string; // The exact resource name of the API method to search for that was provided in `api_docs` tool's output
326+
resourceName: string; // The exact resource name of the API method to search for that was provided in `api_docs` tool's output
327327
}
328328
```
329329

@@ -332,11 +332,11 @@ This tool provides detailed documentation for a specific API method.
332332
```typescript
333333
{
334334
details: Array<{
335-
name: string; // The name of the cache entry
335+
sourceName: string; // The name of the source API
336336
resources: Array<{
337-
name: string; // The name of the resource
337+
resourceName: string; // The name of the resource
338338
resourceType: "query" | "mutation" | "subscription"; // The type of GraphQL resource
339-
description: string; // Context or description of the resource
339+
resourceDescription: string; // Context or description of the resource
340340
details: {
341341
request?: string; // The request structure or input parameters for the API method
342342
response?: string; // The response structure or output format for the API method
@@ -353,12 +353,12 @@ This tool provides detailed documentation for a specific API method.
353353
{
354354
"details": [
355355
{
356-
"name": "GitHubGraphQL",
356+
"sourceName": "GitHubGraphQL",
357357
"resources": [
358358
{
359-
"name": "getUser",
359+
"resourceName": "getUser",
360360
"resourceType": "query",
361-
"description": "Fetch a user by username",
361+
"resourceDescription": "Fetch a user by username",
362362
"details": {
363363
"request": "{ username: String! }",
364364
"response": "{ id: ID!, login: String!, name: String }",

src/tools/api_docs.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,32 @@ server.registerTool('api_docs', {
66
title: 'API Documentation',
77
description: 'Get a list of all available API methods',
88
inputSchema: {
9-
source: z.string().describe('The name of the API source (e.g., "GitHub") from MCP configuration environment variables. If not provided, docs from all sources will be returned.').optional(),
9+
sourceName: z.string().describe('The name of the API source (e.g., "GitHub") from MCP configuration environment variables. If not provided, docs from all sources will be returned.').optional(),
1010
resourceType: z.nativeEnum(ResourceType).describe('The type of the API resource. If provided, only resources of this type will be returned.').optional()
1111
},
1212
outputSchema: {
1313
sources: z.array(z.object({
14-
name: z.string().describe('The name of the source API'),
14+
sourceName: z.string().describe('The name of the source API'),
1515
resources: z.array(z.object({
1616
resourceType: z.nativeEnum(ResourceType).describe('The type of the API resource'),
17-
name: z.string().describe('The name of the API resource'),
18-
description: z.string().describe('A brief description of the API resource'),
17+
resourceName: z.string().describe('The name of the API resource'),
18+
resourceDescription: z.string().describe('A brief description of the API resource'),
1919
}))
2020
}))
2121
}
22-
}, async ({ source, resourceType }: { source?: string, resourceType?: string }) => {
22+
}, async ({ sourceName, resourceType }: { sourceName?: string, resourceType?: string }) => {
2323
return {
2424
content: [],
2525
structuredContent: {
26-
sources: (await CacheManager.getDocs(source))
26+
sources: (await CacheManager.getDocs(sourceName))
2727
.map(doc => ({
28-
name: doc.name,
28+
sourceName: doc.name,
2929
resources: doc.resources
3030
.filter(res => !resourceType || res.type === resourceType)
3131
.map(res => ({
3232
resourceType: res.type,
33-
name: res.name,
34-
description: res.description,
33+
resourceName: res.name,
34+
resourceDescription: res.description,
3535
}))
3636
}))
3737
.filter(doc => doc.resources.length > 0)

src/tools/api_search.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,31 @@ server.registerTool('api_search', {
66
title: 'API detailed documentation search',
77
description: 'Search for a specific API method by name and get its full definition',
88
inputSchema: {
9-
detailName: z.string().describe('The exact resource name of the API method to search for that was provided in `api_docs` tool\'s output'),
9+
resourceName: z.string().describe('The exact resource name of the API method to search for that was provided in `api_docs` tool\'s output'),
1010
sourceName: z.string().describe('The name of the source where the API method is defined that was provided in `api_docs` tool\'s output').optional()
1111
},
1212
outputSchema: {
1313
details: z.array(z.object({
14-
name: z.string().describe('The name of the cache entry'),
14+
sourceName: z.string().describe('The name of the source API'),
1515
resources: z.array(z.object({
16-
name: z.string().describe('The name of the resource'),
16+
resourceName: z.string().describe('The name of the resource'),
1717
resourceType: z.string().describe('The type of API resource'),
18-
description: z.string().describe('Context or description of the resource'),
19-
schema: z.string().describe('The complete schema information for the API method'),
18+
resourceDescription: z.string().describe('Context or description of the resource'),
19+
resourceSchema: z.string().describe('The complete schema information for the API method'),
2020
})).describe('Array of matched resources'),
2121
}))
2222
}
23-
}, async ({ detailName, sourceName }: { detailName: string, sourceName?: string }) => {
23+
}, async ({ resourceName, sourceName }: { resourceName: string, sourceName?: string }) => {
2424
return {
2525
content: [],
2626
structuredContent: {
27-
details: (await CacheManager.getDetails(detailName, sourceName)).map(detail => ({
28-
name: detail.name,
27+
details: (await CacheManager.getDetails(resourceName, sourceName)).map(detail => ({
28+
sourceName: detail.name,
2929
resources: detail.resources.map(res => ({
30-
name: res.name,
30+
resourceName: res.name,
3131
resourceType: res.type,
32-
description: res.description,
33-
schema: res.schema,
32+
resourceDescription: res.description,
33+
resourceSchema: res.schema,
3434
})),
3535
}))
3636
}

0 commit comments

Comments
 (0)