-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
630 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# THIS FILE WAS GENERATED BY `xtp-python-bindgen`. DO NOT EDIT. | ||
|
||
from typing import Optional, List # noqa: F401 | ||
from datetime import datetime # noqa: F401 | ||
import extism # pyright: ignore | ||
import plugin | ||
import json | ||
|
||
from pdk_types import ( | ||
BlobResourceContents, | ||
CallToolRequest, | ||
CallToolResult, | ||
Content, | ||
ContentType, | ||
ListToolsResult, | ||
Params, | ||
Role, | ||
TextAnnotation, | ||
TextResourceContents, | ||
ToolDescription, | ||
) # noqa: F401 | ||
|
||
|
||
# Imports | ||
|
||
# Exports | ||
# The implementations for these functions is in `plugin.py` | ||
|
||
|
||
# Called when the tool is invoked. | ||
# If you support multiple tools, you must switch on the input.params.name to detect which tool is being called. | ||
@extism.plugin_fn | ||
def call(): | ||
extism.log(extism.LogLevel.Error, "beginning of call") | ||
data = json.loads(extism.input_str()) | ||
res = plugin.call(data) | ||
extism.output(res) | ||
|
||
|
||
# Called by mcpx to understand how and why to use this tool. | ||
# Note: Your servlet configs will not be set when this function is called, | ||
# so do not rely on config in this function | ||
@extism.plugin_fn | ||
def describe(): | ||
res = plugin.describe() | ||
extism.output(res) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# THIS FILE WAS GENERATED BY `xtp-python-bindgen`. DO NOT EDIT. | ||
|
||
from typing import Optional, List # noqa: F401 | ||
from datetime import datetime # noqa: F401 | ||
import extism # noqa: F401 # pyright: ignore | ||
|
||
|
||
from pdk_types import ( | ||
BlobResourceContents, | ||
CallToolRequest, | ||
CallToolResult, | ||
Content, | ||
ContentType, | ||
ListToolsResult, | ||
Params, | ||
Role, | ||
TextAnnotation, | ||
TextResourceContents, | ||
ToolDescription, | ||
) # noqa: F401 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
# THIS FILE WAS GENERATED BY `xtp-python-bindgen`. DO NOT EDIT. | ||
|
||
from __future__ import annotations | ||
from enum import Enum # noqa: F401 | ||
from typing import Optional, List # noqa: F401 | ||
from datetime import datetime # noqa: F401 | ||
from dataclasses import dataclass # noqa: F401 | ||
|
||
import extism # noqa: F401 # pyright: ignore | ||
|
||
|
||
@dataclass | ||
class BlobResourceContents(extism.Json): | ||
# A base64-encoded string representing the binary data of the item. | ||
blob: str | ||
|
||
# The MIME type of this resource, if known. | ||
mimeType: str | ||
|
||
# The URI of this resource. | ||
uri: str | ||
|
||
|
||
@dataclass | ||
class CallToolRequest(extism.Json): | ||
method: str | ||
|
||
params: Params | ||
|
||
|
||
@dataclass | ||
class CallToolResult(extism.Json): | ||
content: List[Content] | ||
|
||
# Whether the tool call ended in an error. | ||
# | ||
# If not set, this is assumed to be false (the call was successful). | ||
isError: bool | ||
|
||
|
||
@dataclass | ||
class Content(extism.Json): | ||
annotations: TextAnnotation | ||
|
||
# The base64-encoded image data. | ||
data: str | ||
|
||
# The MIME type of the image. Different providers may support different image types. | ||
mimeType: str | ||
|
||
# The text content of the message. | ||
text: str | ||
|
||
type: ContentType | ||
|
||
|
||
class ContentType(Enum): | ||
Text = "text" | ||
Image = "image" | ||
Resource = "resource" | ||
|
||
|
||
@dataclass | ||
class ListToolsResult(extism.Json): | ||
# The list of ToolDescription objects provided by this servlet. | ||
tools: List[ToolDescription] | ||
|
||
|
||
@dataclass | ||
class Params(extism.Json): | ||
arguments: dict | ||
|
||
name: str | ||
|
||
|
||
class Role(Enum): | ||
Assistant = "assistant" | ||
User = "user" | ||
|
||
|
||
@dataclass | ||
class TextAnnotation(extism.Json): | ||
# Describes who the intended customer of this object or data is. | ||
# | ||
# It can include multiple entries to indicate content useful for multiple audiences (e.g., `["user", "assistant"]`). | ||
audience: List[Role] | ||
|
||
# Describes how important this data is for operating the server. | ||
# | ||
# A value of 1 means "most important," and indicates that the data is | ||
# effectively required, while 0 means "least important," and indicates that | ||
# the data is entirely optional. | ||
priority: float | ||
|
||
|
||
@dataclass | ||
class TextResourceContents(extism.Json): | ||
# The MIME type of this resource, if known. | ||
mimeType: str | ||
|
||
# The text of the item. This must only be set if the item can actually be represented as text (not binary data). | ||
text: str | ||
|
||
# The URI of this resource. | ||
uri: str | ||
|
||
|
||
@dataclass | ||
class ToolDescription(extism.Json): | ||
# A description of the tool | ||
description: str | ||
|
||
# The JSON schema describing the argument input | ||
inputSchema: dict | ||
|
||
# The name of the tool. It should match the plugin / binding name. | ||
name: str |
Oops, something went wrong.